public ActionResult Register(RegisterModel model) { IdentityResult identResult; CinemaStoreUser user = new CinemaStoreUser(); user.Email = model.Email; user.UserName = model.Email; if (ModelState.IsValid) { identResult = UserManager.Create(user, model.Password); if (identResult.Succeeded) { SignInManager.SignIn(user, false, model.RememberMe); return(Redirect("~/Profile")); } else { InitIdentityResultErorr(identResult); } } return(View(model)); }
public ActionResult Edit(ProfileModel model) { CinemaStoreUser user = UserManager.FindById(User.Identity.GetUserId()); if (ModelState.IsValid) { user.UserName = model.GivenName; } return(View(model)); }
public ActionResult Index(ProfileModel model) { string userId = User.Identity.GetUserId(); CinemaStoreUser user = UserManager.FindById(userId); if (user == null) { AuthManager.SignOut(); } else { model = new ProfileModel { Email = user.Email }; } model.Films = filmSrv.GetFilms(model, x => x.UserId == userId); return(View(model)); }