public ActionResult Login(LoginModel model) { if(_user.IsUserExist(model)) { return RedirectToAction("Index", "Home"); } ViewBag.Message = "User doesn't exist"; return View(); }
public bool IsUserExist(LoginModel model) { try { if (this.entities.Users.FirstOrDefault(x => x.Email == model.Email && x.Password == model.Password) == null) { return false; } else { return true; } } catch { return false; } }