Example #1
0
        public Task <string> Login(AccountRegisterLoginViewModel model)
        {
            var accountDto = _mapper.Map <AccountRegisterLoginDto>(model);
            var result     = _userRepository.CreateToken(accountDto);

            return(result);
        }
        public Task <string> CreateToken(AccountRegisterLoginViewModel accountRegisterLoginViewModel)
        {
            var accountRegisterLoginDto = _mapper.Map <AccountRegisterLoginDto>(accountRegisterLoginViewModel);
            var result = _authorizeRepository.CreateToken(accountRegisterLoginDto);

            return(result);
        }
Example #3
0
        public IActionResult Register([FromBody] AccountRegisterLoginViewModel model)
        {
            var result = _iUserService.Create(model);

            if (result.Result == true)
            {
                return(Ok());
            }
            return(BadRequest());
        }
Example #4
0
        public IActionResult Authenticate([FromBody] AccountRegisterLoginViewModel model)
        {
            var tokenstring = _iAuthorizedService.CreateToken(model);

            if (tokenstring == null)
            {
                return(Unauthorized());
            }
            return(Ok(new { token = tokenstring.Result }));
        }
Example #5
0
        public IActionResult Register([FromBody] AccountRegisterLoginViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState.Values.SelectMany(v => v.Errors).Select(modelError => modelError.ErrorMessage).ToList()));
            }

            _iAuthorizedService.Create(model);

            return(Ok());
        }
Example #6
0
        public IActionResult Login([FromBody] AccountRegisterLoginViewModel model)
        {
            var tokenstring = _iUserService.Login(model);

            return(Ok(new { token = tokenstring.Result }));
        }
Example #7
0
        public async Task <bool> Create(AccountRegisterLoginViewModel model)
        {
            var accountDto = _mapper.Map <AccountRegisterLoginDto>(model);

            return(await _userRepository.CreateAsync(accountDto));
        }
 public async Task Create(AccountRegisterLoginViewModel model)
 {
     var accountDto = _mapper.Map <AccountRegisterLoginDto>(model);
     await _authorizeRepository.CreateAsync(accountDto);
 }