public HttpResponseMessage Post(PriceRange priceRange) { Check.If(priceRange).IsNotNull(); var result = _priceRangeService.Create(Mapper.Map<Core.Objects.PriceRange>(priceRange)); if (result == null) { return new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError }; } var response = new HttpResponseMessage { StatusCode = HttpStatusCode.Created }; response.Headers.Location = new Uri(Url.Link("GetPriceRange", new { priceRangeReference = result })); return response; }
public HttpResponseMessage Put(string priceRangeReference, PriceRange priceRange) { Check.If(priceRangeReference).IsNotNullOrEmpty(); Check.If(priceRange).IsNotNull(); var result = _priceRangeService.UpdatePriceRange(priceRangeReference, Mapper.Map<Core.Objects.PriceRange>(priceRange)); return result ? new HttpResponseMessage { StatusCode = HttpStatusCode.OK } : new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError }; }