public ActionResult Delete([DataSourceRequest] DataSourceRequest request, CategoryViewModel category)
        {
            if (category != null)
            {
                db.Categories.Delete(category.CategoryId);
                db.SaveChanges();
            }

            return Json(new[] { category }.ToDataSourceResult(request, ModelState));
        }
        public ActionResult Edit([DataSourceRequest] DataSourceRequest request, CategoryViewModel category)
        {
            if (category != null && ModelState.IsValid)
            {
                var target = db.Categories.GetById(category.CategoryId);
                if (target != null)
                {
                    target.Name = category.CategoryName;
                    db.Categories.Update(target);
                    db.SaveChanges();
                }
            }

            return Json(new[] { category }.ToDataSourceResult(request, ModelState));
        }
        public ActionResult Create([DataSourceRequest] DataSourceRequest request, CategoryViewModel category)
        {
            if (category != null && ModelState.IsValid)
            {
                Category cat = new Category
                {
                    Name = category.CategoryName
                };

                db.Categories.Add(cat);
                db.SaveChanges();
            }

            return Json(new[] { category }.ToDataSourceResult(request, ModelState));
        }