public IActionResult Login(String email, String password) { var model = new UsersLoginModel { Email = email, Password = password, }; return(json(() => new { ticket = model.LogOn() })); }
public ActionResult Login(UsersLoginModel usersLoginModel) { if (ModelState.IsValid) { if (userService.EntityExists(e => e.UserName == usersLoginModel.UserName && e.Password == usersLoginModel.Password && !e.IsDeleted && e.IsActive)) { FormsAuthentication.SetAuthCookie(usersLoginModel.UserName, usersLoginModel.RememberMe); return(RedirectToAction("Index")); } ViewBag.Message = "User Name or Password is incorrect!"; return(View(usersLoginModel)); } ViewBag.Message = "User Name or Password is invalid!"; return(View(usersLoginModel)); }