public HttpResponseMessage Post(string applicationReference, string customerReference, Address address) { Check.If(applicationReference).IsNotNullOrEmpty(); Check.If(customerReference).IsNotNullOrEmpty(); Check.If(address).IsNotNull(); var result = _addressService.CreateCustomerAddress(applicationReference, customerReference, Mapper.Map<Core.Objects.Address>(address)); if (result == null) { return new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError }; } var response = new HttpResponseMessage { StatusCode = HttpStatusCode.Created }; response.Headers.Location = new Uri(Url.Link("GetAddressForCustomer", new { applicationReference, customerReference, addressReference = result })); return response; }
public HttpResponseMessage Put(string applicationReference, string customerReference, string addressReference, Address address) { Check.If(applicationReference).IsNotNullOrEmpty(); Check.If(customerReference).IsNotNullOrEmpty(); Check.If(addressReference).IsNotNullOrEmpty(); Check.If(address).IsNotNull(); var result = _addressService.UpdateCustomerAddress(applicationReference, customerReference, addressReference, Mapper.Map<Core.Objects.Address>(address)); return result ? new HttpResponseMessage { StatusCode = HttpStatusCode.OK } : new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError }; }