Example #1
0
        public HttpResponseMessage Updates(FeatureUpdateRequest model)  //binding to update request model.
        {
            // check data validation
            if (!ModelState.IsValid)                                                        //ModelState == collection of errors, is NOT valid...
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); //...return a error response.
            }

            //invoke the service method and return a SuccessResponse model, no item response is being returned like the above Create() method.
            FeaturesService feature = new FeaturesService();    // invoke the entity's service method

            feature.Update(model);                              // feature to return a model.
            return(Request.CreateResponse(HttpStatusCode.OK, true));
        }