public async Task <IActionResult> UpdateAccountAsync([FromBody] UpdateAgencyRequestModel agency, CancellationToken ct = default) { var agencyId = HttpContext.GetUserContext().AgencyId; await _authenticationService.UpdateAccountAsync(agencyId, agency, ct); return(NoContent()); }
public async Task UpdateAccountAsync(int agencyId, UpdateAgencyRequestModel model, CancellationToken ct = default) { Agency agency = await _agencyRepository.FindByIdAsync(agencyId, ct); _mapper.Map(model, agency); _agencyRepository.Update(agency); await _unitOfWork.SaveChangesAsync(ct); }
public async Task UpdateAccountAsync(UserContextModel userContext, JsonPatchDocument <UpdateAgencyRequestModel> jsonPatch, CancellationToken ct) { Agency agency = await _agencyRepository.GetAll().Where(x => x.Id == userContext.AgencyId).Include (x => x.Employees).FirstOrDefaultAsync(); UpdateAgencyRequestModel jsonPatchDTO = _mapper.Map <UpdateAgencyRequestModel>(agency); jsonPatch.ApplyTo(jsonPatchDTO); _mapper.Map(jsonPatchDTO, agency); _agencyRepository.Update(agency); await _unitOfWork.SaveChangesAsync(); //return jsonPatchDTO; }