Esempio n. 1
0
        public HttpResponseMessage Add(FeatureCreateRequest model) // "public method named "Add" that returns an HtttpResponseMessage, that takes one parameter named "model" of type FeatureAddRequest"
        {
            if (!ModelState.IsValid)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
            }

            //instantiate a a 'feature' entity service object
            FeaturesService    feature  = new FeaturesService();
            ItemResponse <int> response = new ItemResponse <int>();

            response.Item = feature.Create(model);  //uses featuresService
            return(Request.CreateResponse(HttpStatusCode.OK, response));
        }