public ActionResult Index2(AccountEditModel model, HttpPostedFileBase file) { //if (ModelState.IsValid) //{ try { if (file != null) { User user = Current.Connection.Get<User>(Current.UserId); ; AuthenticationService.SignIn(user); var serverPath = Server.MapPath("~/Content/images/" + user.UserName + ".jpg"); file.SaveAs(serverPath); } model.Birthday = null; new AccountEditHandler().Handle(Current.UserId, model); } catch (ValidationException e) { ModelState.AddModelError(e.Key, e.Message); } //} //if (!ModelState.IsValid) //{ // ViewBag.CountryId = Current.Connection.GetList<Country>().ToSelectList(model.CountryId.ToString()); // return this.View(model); //} return RedirectToAction("Index", "Recipient"); }
public void Handle2(int id, AccountEditModel form) { var account = Find(id); account.Password = form.Password; account.Email = form.Email; Update(account); }
public void Handle(int id, AccountEditModel form) { var account = Find(id); account.FirstName = form.FirstName; account.LastName = form.LastName; //account.Birthday = form.Birthday.ToDate(); account.CountryId = form.CountryId; account.Age = form.Age; account.City = form.City; account.MaritalStatus = form.MaritalStatus; Update(account); }
public ActionResult SecretInfo(AccountEditModel form) { try { User ExistedUser = (User)Session["user"]; ExistedUser.ColourId = form.ColourId; ExistedUser.IconId = form.IconId; ExistedUser.SecretPhrase = form.SecretPhrase; UsersAddHandler usersAddHandler = new UsersAddHandler(); usersAddHandler.Update(ExistedUser); return RedirectToAction("SignIn", "Authentication"); } catch (ValidationException e) { ModelState.AddModelError(e.Key, e.Message); return this.View(); } }
public ActionResult Signin5(AccountEditModel form) { //if (ModelState.IsValid) //{ try { User currentUser = (User)Session["Signin1Store"]; UsersAddHandler usersAddHandler = new UsersAddHandler(); User ExistedUser = usersAddHandler.Find(currentUser.Email); ExistedUser.ColourId = form.ColourId; ExistedUser.IconId = form.IconId; ExistedUser.SecretPhrase = form.SecretPhrase; usersAddHandler.Update(ExistedUser); Session["Signin1Store"] = currentUser; Session["Signin2Store"] = Session["Signin2Store"]; Session["Signin3Store"] = Session["Signin3Store"]; //Session["Signin4Store"] = Session["Signin4Store"]; return RedirectToAction("Signin6", "Registration"); } catch (ValidationException e) { ModelState.AddModelError(e.Key, e.Message); return this.View(); } //} return RedirectToAction("Signin6", "Registration"); }
public ActionResult ChangePassword3(AccountEditModel form) { try { new AccountEditHandler().Handle2(Current.UserId, form); } catch (ValidationException e) { ModelState.AddModelError(e.Key, e.Message); } if (!ModelState.IsValid) return this.View(); return RedirectToAction("Index3", "MyAccount"); }