public virtual ActionResult Index(UserCreateModel u) { ViewData["create"] = u; Ascend.Core.User.ValidateEmail(null, u.Email, Users, ModelState); Ascend.Core.User.ValidateLogin(null, u.Login, Users, ModelState); if (!ModelState.IsValid) { return View(Users.All().WithDocuments()); } var x = u.CreateUser(); try { Users.Save(x); if (u.Welcome) { if (x.State == UserState.Active) { Messaging.SendWelcome(ControllerContext.RequestContext, x); } else if (x.State == UserState.Registered) { Messaging.SendActivation(ControllerContext.RequestContext, x); } } return this.RedirectToAction(c => c.Edit(x.Document.Id)); } catch (Exception ex) { Notifier.Notify(ex); return View(Users.All().WithDocuments()); } }