public ActionResult Login(LoginViewModel model)
        {
            if (_accountFacade.Login(Mapper.Map <LoginData>(model)))
            {
                return(RedirectToRoute("Home"));
            }

            model.ErrorMessage = "Incorrect username or password";
            return(View(model));
        }
Exemple #2
0
        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));
            }
        }
Exemple #3
0
        public LoginResponse Login([FromBody] LoginRequest request)
        {
            LoginResponse response = _accountFacade.Login(request);

            return(response);
        }