public ActionResult Edit([Bind(Include = "Id,UserAccount, UserClass, Email, Password, RePassword, UserName")] Library.User user) { user.Id = userWeb.GetUsers().Single(g => g.Id == user.Id).Id; if (!ModelState.IsValid) { return(View("Edit", user)); } userWeb.SaveUser(user); byte UserClass = 0; if (Session["Id"] != null) { byte.TryParse(Session["UserClass"].ToString(), out UserClass); } if (UserClass == 2) { return(RedirectToAction("Index", "User")); } else { if (Session["Id"] != null) { Session["UserName"] = user.UserName; } return(RedirectToAction("Index", "Message")); } }
public ActionResult Edit([Bind(Include = "UserAccount, UserClass, Email, Password, UserName")] Library.User user) { UserWeb userWeb = new UserWeb(); user.Id = userWeb.Users.Single(g => g.Id == user.Id).Id; if (!ModelState.IsValid) { return(View("Edit", user)); } userWeb.SaveUser(user); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,UserAccount, UserClass, Email, Password, RePassword, UserName")] Library.User user) { user.Id = userWeb.GetUsers().Single(g => g.Id == user.Id).Id; if (!ModelState.IsValid) { return(View("Edit", user)); } userWeb.SaveUser(user); if (SessionManagement.LoginUser != null) { Session.Remove(SessionManagement.LoginUser.UserName); SessionManagement.LoginUser.UserName = user.UserName; } if (SessionManagement.LoginUser.UserClass == 2) { return(RedirectToAction("Index", "User")); } else { return(RedirectToAction("Index", "Message")); } }