public HttpResponseMessage Post([FromBody] CreatePartyDto value) { try { if (value.PartyId == default(string)) { throw DomainError.Named("nullId", "Aggregate Id in cmd is null, aggregate name: {0}.", "Party"); } _partyApplicationService.When(value as ICreateParty); var idObj = value.PartyId; return(Request.CreateResponse <string>(HttpStatusCode.Created, idObj)); } catch (Exception ex) { var response = HttpServiceExceptionUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public async Task WhenAsync(CreatePartyDto c) { var idObj = (c as ICreateParty).PartyId; var uriParameters = new PartyUriParameters(); uriParameters.Id = idObj; var req = new PartyPutRequest(uriParameters, (CreatePartyDto)c); var resp = await _ramlClient.Party.Put(req); PartyProxyUtils.ThrowOnHttpResponseError(resp); }
public void When(CreatePartyDto c) { WhenAsync(c).GetAwaiter().GetResult(); }