public HttpResponseMessage Put(string landlordReference, Landlord landlord) { Check.If(landlordReference).IsNotNullOrEmpty(); Check.If(landlord).IsNotNull(); var result = _propertyService.UpdateLandlord(landlordReference, Mapper.Map<Core.Objects.Landlord>(landlord)); return result ? new HttpResponseMessage { StatusCode = HttpStatusCode.OK } : new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError }; }
public HttpResponseMessage Post(Landlord landlord) { Check.If(landlord).IsNotNull(); var result = _propertyService.CreateLandlord(Mapper.Map<Core.Objects.Landlord>(landlord)); if (result == null) { return new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError }; } var response = new HttpResponseMessage { StatusCode = HttpStatusCode.Created }; response.Headers.Location = new Uri(Url.Link("GetLandlord", new { landlordReference = result })); return response; }