public IActionResult Put(Guid id, [FromBody] AccountUserUpdateRequest request) { try { _userService.Update(id, request); return(Ok(new ApiResponse(200))); } catch (Exception ex) { return(BadRequest(new ApiBadRequestResponse(400, "Terjadi Kesalahan"))); } }
public void Update(Guid Id, AccountUserUpdateRequest accountUser) { try { _accountUserRepository.BeginTransaction(); var data = _accountUserRepository.Get(x => x.Id == Id, false).SingleOrDefault(); if (data != null) { var dataUpdated = _mapper.Map <AccountUser>(accountUser); dataUpdated.Id = data.Id; _accountUserRepository.Update(dataUpdated); } _accountUserRepository.Save(); _accountUserRepository.CommitTransaction(); } catch (Exception ex) { _accountUserRepository.RollbackTransaction(); throw ex; } }
public ApiDto Update(Guid Id, AccountUserUpdateRequest request) => new HTTPWebRequestUtilities <ApiDto>(_urlApiFactory.GetUrl(ServiceType.User)) .Request(Global.Method.PUT, $"User/{Id}", request);