예제 #1
0
 public IActionResult Post([FromBody] AccountUserCreateRequest request)
 {
     try
     {
         _userService.Add(request);
         return(Ok(new ApiResponse(200)));
     }
     catch (Exception ex)
     {
         return(BadRequest(new ApiBadRequestResponse(400, "Terjadi Kesalahan")));
     }
 }
예제 #2
0
 public async Task AddAsync(AccountUserCreateRequest accountUser)
 {
     try
     {
         var dataInserted = _mapper.Map <AccountUser>(accountUser);
         _accountUserDAL.Insert(dataInserted);
         await _uow.Commit();
     }
     catch (Exception ex)
     {
         // Log here
         throw ex;
     }
 }
예제 #3
0
        public async Task <IActionResult> PostAsync([FromBody] AccountUserCreateRequest request)
        {
            try
            {
                var command = _mapper.Map <CreateUserCommand>(request);
                await _commandHandler.Handle(command, CancellationToken.None);

                //await _accountUserBLL.AddAsync(request);
                return(Ok(new ApiResponse(200)));
            }
            catch (Exception ex)
            {
                return(BadRequest(new ApiBadRequestResponse(400, "Terjadi Kesalahan")));
            }
        }
예제 #4
0
        public void Add(AccountUserCreateRequest request)
        {
            try
            {
                _accountUserRepository.BeginTransaction();

                var dataInserted = _mapper.Map <AccountUser>(request);
                _accountUserRepository.Insert(dataInserted);
                _accountUserRepository.Save();
                _accountUserRepository.CommitTransaction();
            }
            catch (Exception ex)
            {
                //logHere
                _accountUserRepository.RollbackTransaction();
                throw ex;
            }
        }
예제 #5
0
 public ApiDto Add(AccountUserCreateRequest accountUser)
 => new HTTPWebRequestUtilities <ApiDto>(_urlApiFactory.GetUrl(ServiceType.User))
 .Request(Global.Method.POST, $"User", accountUser);