public ActionResult Login(LoginViewModel model) { if (_accountFacade.Login(Mapper.Map <LoginData>(model))) { return(RedirectToRoute("Home")); } model.ErrorMessage = "Incorrect username or password"; return(View(model)); }
public async Task <JsonResult> Login([FromBody] LoginViewModel loginViewModel) { try { var token = await _accountFacade.Login(loginViewModel); return(Json(token)); } catch (LoginErrorException e) { Response.StatusCode = (int)HttpStatusCode.BadRequest; return(Json(e.Message)); } catch (Exception e) { Response.StatusCode = 500; return(Json(e.Message)); } }
public LoginResponse Login([FromBody] LoginRequest request) { LoginResponse response = _accountFacade.Login(request); return(response); }