public IEnumerable <CategoryInputView> Get()
        {
            var models = repo.getAllCategoryInputs();
            var views  = CategoryInputView.getViews(models);

            return(views);
        }
        public HttpResponseMessage Post(CategoryInputView view)
        {
            var model = view.getModel(repo);

            model = repo.createCategoryInput(model);
            view  = new CategoryInputView(model);

            var    response = Request.CreateResponse <CategoryInputView>(HttpStatusCode.Created, view);
            string uri      = Url.Route(null, new { id = view.id });

            response.Headers.Location = new Uri(Request.RequestUri, uri);
            return(response);
        }
        public HttpResponseMessage Get(int id)
        {
            var model = repo.getCategoryInput(id);

            if (model == null)
            {
                return(Request.CreateResponse(HttpStatusCode.NotFound));
            }
            else
            {
                var view = new CategoryInputView(model);
                return(Request.CreateResponse(HttpStatusCode.OK, view));
            }
        }
        public HttpResponseMessage CategoryInputs(int id)
        {
            var model = repo.getCategory(id);

            if (model == null)
            {
                return(Request.CreateResponse(HttpStatusCode.NotFound));
            }
            else
            {
                var categoryInputs = model.categoryInputs;
                var views          = CategoryInputView.getViews(categoryInputs);
                return(Request.CreateResponse(HttpStatusCode.OK, views));
            }
        }
        public void Put(CategoryInputView view)
        {
            var model = view.getModel(repo);

            repo.update(model);
        }