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