public IActionResult LoginByCustomer([FromBody] LoginByCustomerCommand command)
        {
            string email = command.Email;
            string pin   = command.Pin;

            bool changePinResult = _authService.ChangePin(email, pin);

            if (!changePinResult)
            {
                return(null);
            }

            LoginByCustomerDto loginByCustomerDto = _authService.LoginByCustomer(email, pin);

            if (loginByCustomerDto == null)
            {
                return(NotFound());
            }
            GetToken getToken = new GetToken(_configuration);
            LoginByCustomerViewModel model = _mapper.Map <LoginByCustomerViewModel>(loginByCustomerDto);

            model.Token        = getToken.Token;
            model.RefreshToken = _authService.GetRefreshToken(email);

            return(Ok(model));
        }
Пример #2
0
        public async Task <ResultServiceModel <LoginByCustomerViewModel> > LoginByCustomer(string email, string pin)
        {
            LoginByCustomerCommand model = new LoginByCustomerCommand()
            {
                Email = email,
                Pin   = pin
            };

            string url = serviceUrl + "LoginByCustomer";

            return(await Post <LoginByCustomerViewModel>(url, model));
        }