public async Task WhenAsync(CreateFacilityDto c) { var idObj = (c as ICreateFacility).FacilityId; var uriParameters = new FacilityUriParameters(); uriParameters.Id = idObj; var req = new FacilityPutRequest(uriParameters, (CreateFacilityDto)c); var resp = await _ramlClient.Facility.Put(req); FacilityProxyUtils.ThrowOnHttpResponseError(resp); }
public HttpResponseMessage Post([FromBody] CreateFacilityDto value) { try { if (value.FacilityId == default(string)) { throw DomainError.Named("nullId", "Aggregate Id in cmd is null, aggregate name: {0}.", "Facility"); } _facilityApplicationService.When(value as ICreateFacility); var idObj = value.FacilityId; return(Request.CreateResponse <string>(HttpStatusCode.Created, idObj)); } catch (Exception ex) { var response = FacilitiesControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public void When(CreateFacilityDto c) { WhenAsync(c).GetAwaiter().GetResult(); }