Ejemplo n.º 1
0
 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); }
 }
Ejemplo n.º 2
0
        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); }
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
 public void When(CreateLocatorDto c)
 {
     WhenAsync(c).GetAwaiter().GetResult();
 }