public void Put(string id, [FromBody] CreateLocatorDto value) { try { LocatorsControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value); _locatorApplicationService.When(value as ICreateLocator); } catch (Exception ex) { var response = LocatorsControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public HttpResponseMessage Post([FromBody] CreateLocatorDto value) { try { if (value.LocatorId == default(string)) { throw DomainError.Named("nullId", "Aggregate Id in cmd is null, aggregate name: {0}.", "Locator"); } _locatorApplicationService.When(value as ICreateLocator); var idObj = value.LocatorId; return(Request.CreateResponse <string>(HttpStatusCode.Created, idObj)); } catch (Exception ex) { var response = HttpServiceExceptionUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public async Task WhenAsync(CreateLocatorDto c) { var idObj = (c as ICreateLocator).LocatorId; var uriParameters = new LocatorUriParameters(); uriParameters.Id = idObj; var req = new LocatorPutRequest(uriParameters, (CreateLocatorDto)c); var resp = await _ramlClient.Locator.Put(req); LocatorProxyUtils.ThrowOnHttpResponseError(resp); }
public void When(CreateLocatorDto c) { WhenAsync(c).GetAwaiter().GetResult(); }