示例#1
0
        public IActionResult OnPostLogin(Login command)
        {
            var result = _accountApplication.Login(command);

            if (result.IsSucceeded)
            {
                return(RedirectToPage("/Index"));
            }
            LoginMessage = result.Message;
            return(RedirectToPage("/Account"));
        }
示例#2
0
        public IActionResult Login(Login command)
        {
            var result = _accountApplication.Login(command);

            if (result.IsSuccedded)
            {
                return(Ok(result.Message));
            }
            else
            {
                return(StatusCode(200, "Your information is invalid"));
            }
        }
示例#3
0
        public IActionResult OnPostLogin()
        {
            var operationResult = new OperationResult();

            operationResult = _accountApplication.Login(LoginModel);
            if (operationResult.IsSucceeded)
            {
                return(RedirectToPage("./Index"));
            }

            LoginMessage = operationResult.Message;

            return(Page());
        }
        public async Task <IActionResult> Login([FromBody] LoginViewModel login)
        {
            try
            {
                AppResult <LoginViewModel> result = await _accountApp.Login(login);

                if (result.ValidationResult.IsValid)
                {
                    return(Ok(result));
                }
                else
                {
                    return(Unauthorized(result.ValidationResult.Errors.FirstOrDefault().ErrorMessage));
                }
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }