public HttpResponseMessage Post([FromBody] CreateLocatorTypeDto value) { try { if (value.LocatorTypeId == default(string)) { throw DomainError.Named("nullId", "Aggregate Id in cmd is null, aggregate name: {0}.", "LocatorType"); } _locatorTypeApplicationService.When(value as ICreateLocatorType); var idObj = value.LocatorTypeId; return(Request.CreateResponse <string>(HttpStatusCode.Created, idObj)); } catch (Exception ex) { var response = LocatorTypesControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public async Task WhenAsync(CreateLocatorTypeDto c) { var idObj = (c as ICreateLocatorType).LocatorTypeId; var uriParameters = new LocatorTypeUriParameters(); uriParameters.Id = idObj; var req = new LocatorTypePutRequest(uriParameters, (CreateLocatorTypeDto)c); var resp = await _ramlClient.LocatorType.Put(req); LocatorTypeProxyUtils.ThrowOnHttpResponseError(resp); }
public void When(CreateLocatorTypeDto c) { WhenAsync(c).GetAwaiter().GetResult(); }