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