public HttpResponseMessage PostCheck(string propertyReference, PropertyCheck check) { Check.If(propertyReference).IsNotNullOrEmpty(); Check.If(check).IsNotNull(); var result = _checkService.CreateCheck(propertyReference, Mapper.Map<Core.Objects.PropertyCheck>(check)); if (result == null) { return new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError }; } var response = new HttpResponseMessage { StatusCode = HttpStatusCode.Created }; response.Headers.Location = new Uri(Url.Link("GetPropertyCheck", new { propertyReference, propertyCheckReference = result })); return response; }
public HttpResponseMessage PutCheck(string propertyReference, string propertyCheckReference, PropertyCheck check) { Check.If(propertyReference).IsNotNullOrEmpty(); Check.If(propertyCheckReference).IsNotNullOrEmpty(); Check.If(check).IsNotNull(); var result = _checkService.UpdateCheck(propertyReference, propertyCheckReference, Mapper.Map<Core.Objects.PropertyCheck>(check)); return result ? new HttpResponseMessage { StatusCode = HttpStatusCode.OK } : new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError }; }