public async Task <Guid> DebtorHideAddressAsync(DebtorHideAddressRequest model) { var moratorium = await _client.For <Ntt_breathingspacemoratorium>() .Key(model.MoratoriumId) .Expand(x => x.ntt_debtorid) .FindEntryAsync(); if (moratorium == null) { throw new NotFoundHttpResponseException(); } var bsStatus = moratorium.GetMoratoriumStatus(); if (bsStatus != MoratoriumStatus.Active && bsStatus != MoratoriumStatus.Draft) { throw new ConflictHttpResponseException(); } var result = await _client.For <Ntt_breathingspacedebtor>() .Key(moratorium.ntt_debtorid.Ntt_breathingspacedebtorid) .Set(new { ntt_addresswithheld = model.HideAddress }) .UpdateEntryAsync(true); var contentDict = new Dictionary <string, object> { { nameof(moratorium.ntt_debtorid.Ntt_breathingspacedebtorid), moratorium.ntt_debtorid.Ntt_breathingspacedebtorid }, { nameof(model.HideAddress), model.HideAddress } }; await _auditService.PerformAuditing(_auditContext.ToAuditDetail(contentDict)); return(result.Ntt_breathingspacedebtorid.Value); }
public async Task <IStatusCodeActionResult> DebtorHideAddressAsync([FromRoute] Guid id, DebtorHideAddressRequest model) { if (id == Guid.Empty) { throw new NotFoundHttpResponseException(); } model.MoratoriumId = id; var updatedAddressId = await _moneyAdviserGateway.DebtorHideAddressAsync(model); return(Ok(updatedAddressId)); }