Beispiel #1
0
        public async Task <ResponseModel <AccountModelApi <int> > > RegisterUserAsync(AccountModelApi <int> model)
        {
            var registeredUser = await this._accountRepository.CreateAsync(
                AutoMapperConfig.Mapper.Map <AccountModelBussines <int> >(model)
                );

            ResponseModel <AccountModelApi <int> > resp = new ResponseModel <AccountModelApi <int> >(
                AutoMapperConfig.Mapper.Map <AccountModelApi <int> >(registeredUser)
                );

            if (registeredUser == null)
            {
                resp.AddError(new Error($"User with {model.Email} alredy exists."));
                return(resp);
            }

            await this._redisCachingService.RemoveItemAsync(RedisCachingKeysUtil.GET_ACCOUNT_BY_EMAIL_KEY);

            await this._accountSubscriptionService.SubscribeUserByIdDefaultAsync(registeredUser.Id);

            //ToDo : make crypto

            return(resp);
        }
Beispiel #2
0
        public async Task <IActionResult> SignUpAsync([FromBody] AccountModelApi <int> model)
        {
            var res = await _accountService.RegisterUserAsync(model);

            return(Ok(res));
        }