public ActionResult Login(LoginModel model) { if (model.IsValid()) { return Redirect("/user/apps"); } model.Msg = "bir sorun oluştu"; return View(model); }
public async Task<ActionResult> Login(LoginModel model) { if (!model.IsValid()) { model.Msg = "bir sorun oluştu"; return View(model); } var authenticated = await _userService.Authenticate(model.Email, model.Password); if (!authenticated) { model.Msg = "bir sorun oluştu"; return View(model); } var user = await _userService.GetByEmail(model.Email); _formsAuthenticationService.SignIn(string.Format("{0}|{1}", user.Id, user.Name), true); return Redirect("/user/apps"); }