public HttpResponseMessage Post(string applicationReference, string customerReference, TelephoneNumber telephoneNumber) { Check.If(applicationReference).IsNotNullOrEmpty(); Check.If(customerReference).IsNotNullOrEmpty(); Check.If(telephoneNumber).IsNotNull(); var result = _telephoneNumberService.CreateCustomerTelephoneNumber(applicationReference, customerReference, Mapper.Map<Core.Objects.TelephoneNumber>(telephoneNumber)); if (result == null) { return new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError }; } var response = new HttpResponseMessage { StatusCode = HttpStatusCode.Created }; response.Headers.Location = new Uri(Url.Link("GetTelephoneNumberForCustomer", new { applicationReference, customerReference, telephoneNumberReference = result })); return response; }
public HttpResponseMessage Put(string applicationReference, string customerReference, string telephoneNumberReference, TelephoneNumber number) { Check.If(applicationReference).IsNotNullOrEmpty(); Check.If(customerReference).IsNotNullOrEmpty(); Check.If(telephoneNumberReference).IsNotNullOrEmpty(); Check.If(number).IsNotNull(); var result = _telephoneNumberService.UpdateCustomerTelephoneNumber(applicationReference, customerReference, telephoneNumberReference, Mapper.Map<Core.Objects.TelephoneNumber>(number)); return result ? new HttpResponseMessage { StatusCode = HttpStatusCode.OK } : new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError }; }