Beispiel #1
0
        public HttpResponseMessage Put(HttpRequestMessage request, FooterViewModel footerVm)
        {
            return(CreateHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;
                if (!ModelState.IsValid)
                {
                    request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
                }
                else
                {
                    var footerDb = _footerService.GetByID(footerVm.ID);
                    footerDb.UpdateFooter(footerVm);
                    _footerService.Update(footerDb);
                    _footerService.SaveChanges();

                    response = request.CreateResponse(HttpStatusCode.OK);
                }
                return response;
            }));
        }