public void Put(string id, [FromBody] CreateInOutDto value) { try { InOutsControllerUtils.SetNullIdOrThrowOnInconsistentIds(id, value); _inOutApplicationService.When(value as ICreateInOut); } catch (Exception ex) { var response = InOutsControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public async Task WhenAsync(CreateInOutDto c) { var idObj = (c as ICreateInOut).DocumentNumber; var uriParameters = new InOutUriParameters(); uriParameters.Id = idObj; var req = new InOutPutRequest(uriParameters, (CreateInOutDto)c); var resp = await _ramlClient.InOut.Put(req); InOutProxyUtils.ThrowOnHttpResponseError(resp); }
public HttpResponseMessage Post([FromBody] CreateInOutDto value) { try { if (value.DocumentNumber == default(string)) { throw DomainError.Named("nullId", "Aggregate Id in cmd is null, aggregate name: {0}.", "InOut"); } _inOutApplicationService.When(value as ICreateInOut); var idObj = value.DocumentNumber; return(Request.CreateResponse <string>(HttpStatusCode.Created, idObj)); } catch (Exception ex) { var response = HttpServiceExceptionUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); } }
public void When(CreateInOutDto c) { WhenAsync(c).GetAwaiter().GetResult(); }