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