public HttpResponseMessage PostFeature(string landlordReference, string submittedPropertyReference, Feature feature) { Check.If(landlordReference).IsNotNullOrEmpty(); Check.If(submittedPropertyReference).IsNotNullOrEmpty(); Check.If(feature).IsNotNull(); var result = _featureService.CreateFeature(landlordReference, submittedPropertyReference, Mapper.Map<Core.Objects.Feature>(feature)); if (result == null) { return new HttpResponseMessage {StatusCode = HttpStatusCode.InternalServerError}; } var response = new HttpResponseMessage {StatusCode = HttpStatusCode.Created}; response.Headers.Location = new Uri(Url.Link("GetSubmittedPropertyFeature", new {landlordReference, submittedPropertyReference, featureReference = result})); return response; }
public HttpResponseMessage PutFeature(string landlordReference, string submittedPropertyReference, string featureReference, Feature feature) { Check.If(landlordReference).IsNotNullOrEmpty(); Check.If(submittedPropertyReference).IsNotNullOrEmpty(); Check.If(featureReference).IsNotNullOrEmpty(); Check.If(feature).IsNotNull(); var result = _featureService.UpdateFeature(landlordReference, submittedPropertyReference, featureReference, Mapper.Map<Core.Objects.Feature>(feature)); return result ? new HttpResponseMessage {StatusCode = HttpStatusCode.OK} : new HttpResponseMessage {StatusCode = HttpStatusCode.InternalServerError}; }