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); } }
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); }
public void When(CreateContactMechDto c) { WhenAsync(c).GetAwaiter().GetResult(); }