public ActionResult Create(UserEvent participant)
{
try
{
if (repository.Users.Where(x => x.Email.Equals(participant.UserEmail)).Count() == 0)
{
participant.UserEmail = participant.UserEmail.ToLower();
var name = participant.UserEmail;
if (name.Contains(".") || name.Contains("-") || name.Contains("."))
{
name = participant.UserEmail.Replace("capgemini.com", "");
name = name.Replace("-", " ");
name = name.Replace(".", " ");
name = name.Substring(0, name.Length - 1);
name = System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(name.ToLower());
}
accountrepository.Create(participant.UserEmail, null, name);
}
repository.SaveParticipant(participant);
}
catch (Exception e)
{
this.Error(e.Message);
}
return RedirectToAction("GetParticipants", new { eventId = participant.EventId });
}