public HttpResponseMessage Post([FromBody] CreateItemIssuanceMvoDto value) { try { if (value.ShipmentItemIssuanceId == default(ShipmentItemIssuanceId)) { throw DomainError.Named("nullId", "Aggregate Id in cmd is null, aggregate name: {0}.", "ItemIssuanceMvo"); } _itemIssuanceMvoApplicationService.When(value as ICreateItemIssuanceMvo); var idObj = value.ShipmentItemIssuanceId; return(Request.CreateResponse <ShipmentItemIssuanceId>(HttpStatusCode.Created, idObj)); } catch (Exception ex) { var response = ItemIssuanceMvosControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public async Task WhenAsync(CreateItemIssuanceMvoDto c) { var idObj = ItemIssuanceMvoProxyUtils.ToIdString((c as ICreateItemIssuanceMvo).ShipmentItemIssuanceId); var uriParameters = new ItemIssuanceMvoUriParameters(); uriParameters.Id = idObj; var req = new ItemIssuanceMvoPutRequest(uriParameters, (CreateItemIssuanceMvoDto)c); var resp = await _ramlClient.ItemIssuanceMvo.Put(req); ItemIssuanceMvoProxyUtils.ThrowOnHttpResponseError(resp); }
public void When(CreateItemIssuanceMvoDto c) { WhenAsync(c).GetAwaiter().GetResult(); }