public void Put(string id, [FromBody] CreateOrganizationStructureDto value) { try { OrganizationStructuresControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value); _organizationStructureApplicationService.When(value as ICreateOrganizationStructure); } catch (Exception ex) { var response = OrganizationStructuresControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public HttpResponseMessage Post([FromBody] CreateOrganizationStructureDto value) { try { if (value.Id == default(OrganizationStructureId)) { throw DomainError.Named("nullId", "Aggregate Id in cmd is null, aggregate name: {0}.", "OrganizationStructure"); } _organizationStructureApplicationService.When(value as ICreateOrganizationStructure); var idObj = value.Id; return(Request.CreateResponse <OrganizationStructureId>(HttpStatusCode.Created, idObj)); } catch (Exception ex) { var response = OrganizationStructuresControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public async Task WhenAsync(CreateOrganizationStructureDto c) { var idObj = OrganizationStructureProxyUtils.ToIdString((c as ICreateOrganizationStructure).Id); var uriParameters = new OrganizationStructureUriParameters(); uriParameters.Id = idObj; var req = new OrganizationStructurePutRequest(uriParameters, (CreateOrganizationStructureDto)c); var resp = await _ramlClient.OrganizationStructure.Put(req); OrganizationStructureProxyUtils.ThrowOnHttpResponseError(resp); }
public void When(CreateOrganizationStructureDto c) { WhenAsync(c).GetAwaiter().GetResult(); }