public ActionResult DoLogin(User model) { var user = service.Login(model.UserName, model.Password); if (user != null) { FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(model.UserName, false, 1); string encriptTicket = FormsAuthentication.Encrypt(authTicket); HttpCookie authCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encriptTicket); Response.Cookies.Add(authCookie); HttpContext.Application.Add("USER", user); return RedirectToAction("Welcome", "home"); } else { ModelState.AddModelError("", "Usuário ou Senha incorretos."); return View("Login", model); } }
public ActionResult CreateUser(User model) { service.CreateUser(model); return RedirectToAction("ListUsers"); }
public void DeleteUser(User user) { new GenericRepository<User>().Delete(user); }
public void UpdateUser(User user) { new GenericRepository<User>().Update(user); }
public void CreateUser(User user) { new GenericRepository<User>().Create(user); }