Ejemplo n.º 1
0
        public HttpResponseMessage Post([FromBody] CreatePicklistBinDto value)
        {
            try {
                if (value.PicklistBinId == default(string))
                {
                    throw DomainError.Named("nullId", "Aggregate Id in cmd is null, aggregate name: {0}.", "PicklistBin");
                }
                _picklistBinApplicationService.When(value as ICreatePicklistBin);
                var idObj = value.PicklistBinId;

                return(Request.CreateResponse <string>(HttpStatusCode.Created, idObj));
            } catch (Exception ex) { var response = HttpServiceExceptionUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); }
        }
        public async Task WhenAsync(CreatePicklistBinDto c)
        {
            var idObj         = (c as ICreatePicklistBin).PicklistBinId;
            var uriParameters = new PicklistBinUriParameters();

            uriParameters.Id = idObj;

            var req = new PicklistBinPutRequest(uriParameters, (CreatePicklistBinDto)c);

            var resp = await _ramlClient.PicklistBin.Put(req);

            PicklistBinProxyUtils.ThrowOnHttpResponseError(resp);
        }
 public void When(CreatePicklistBinDto c)
 {
     WhenAsync(c).GetAwaiter().GetResult();
 }