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

                return(Request.CreateResponse <string>(HttpStatusCode.Created, idObj));
            } catch (Exception ex) { var response = HttpServiceExceptionUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); }
        }
Ejemplo n.º 2
0
        public async Task WhenAsync(CreatePartyDto c)
        {
            var idObj         = (c as ICreateParty).PartyId;
            var uriParameters = new PartyUriParameters();

            uriParameters.Id = idObj;

            var req = new PartyPutRequest(uriParameters, (CreatePartyDto)c);

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

            PartyProxyUtils.ThrowOnHttpResponseError(resp);
        }
Ejemplo n.º 3
0
 public void When(CreatePartyDto c)
 {
     WhenAsync(c).GetAwaiter().GetResult();
 }