public ActionResult Create(PersonsViewModel model) { try { var password = string.Join("", Guid.NewGuid().ToString().Take(8)); var user = new User() { Email = model.Email, Password = password, Roles = model.Roles == Roles.Director?"Director": model.Roles == Roles.User ? "User":"******", UserDetails = new UserDetails() { FirstName = model.FirstName, LastName = model.LastName } }; _db.AddUser(user); return(RedirectToAction("Index")); } catch { return(View()); } }