public ActionResult Login(User user) { var returnedUser = UserDAO.SearchByEmailPassword(user.Email, user.Password); if (returnedUser == null) { ModelState.AddModelError("", "Error - Email or Password incorrect"); return(View(user)); } if (returnedUser.UserType.Equals(nameof(Pub))) { var pub = PubDAO.SearchByUserId(returnedUser.Id); UserSession.ReturnPubId(pub.Id); UserSession.ReturnUserId(pub.UserId); return(RedirectToAction("Dashboard", "Pub")); } else if (returnedUser.UserType.Equals(nameof(Person))) { var person = PersonDAO.SearchByUserId(returnedUser.Id); UserSession.ReturnPersonId(person.Id); UserSession.ReturnUserId(person.UserId); return(RedirectToAction("Dashboard", "Person")); } ModelState.AddModelError("", "Error - I dont know"); return(View("Login", user)); }
public ActionResult UpdateLayout(string layout) { var update = PersonDAO.SearchByUserId(UserSession.ReturnUserId(null)); update.LayoutStyle = layout; Update(update); return RedirectToAction("Account"); }