Esempio n. 1
0
        public HttpResponseMessage ChangeStatus(HttpRequestMessage request, int id)
        {
            return(CreateHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;
                if (!ModelState.IsValid)
                {
                    response = request.CreateResponse(HttpStatusCode.BadRequest, ModelState);
                }
                else
                {
                    _feedbackService.ChangeStatus(id);
                    _feedbackService.Save();
                    var oldFeedback = _feedbackService.GetById(id);
                    var responseData = Mapper.Map <Feedback, FeedbackViewModel>(oldFeedback);
                    response = request.CreateResponse(HttpStatusCode.Created, responseData);
                }

                return response;
            }));
        }