예제 #1
0
        public HttpResponseMessage Post([FromBody] CreateContactMechDto value)
        {
            try {
                if (value.ContactMechId == default(string))
                {
                    throw DomainError.Named("nullId", "Aggregate Id in cmd is null, aggregate name: {0}.", "ContactMech");
                }
                _contactMechApplicationService.When(value as ICreateContactMech);
                var idObj = value.ContactMechId;

                return(Request.CreateResponse <string>(HttpStatusCode.Created, idObj));
            } catch (Exception ex) { var response = ContactMechesControllerUtils.GetErrorHttpResponseMessage(ex); throw new HttpResponseException(response); }
        }
예제 #2
0
        public async Task WhenAsync(CreateContactMechDto c)
        {
            var idObj         = (c as ICreateContactMech).ContactMechId;
            var uriParameters = new ContactMechUriParameters();

            uriParameters.Id = idObj;

            var req = new ContactMechPutRequest(uriParameters, (CreateContactMechDto)c);

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

            ContactMechProxyUtils.ThrowOnHttpResponseError(resp);
        }
예제 #3
0
 public void When(CreateContactMechDto c)
 {
     WhenAsync(c).GetAwaiter().GetResult();
 }