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