public JsonResult DestroyCommand([DataSourceRequest] DataSourceRequest request, CategoryVewModel model)
        {
            if (ModelState.IsValid)
            {
                this.Data.Categories.Delete(model.Id);
                this.Data.SaveChanges();
            }

            return Json(new[] { model }.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
        }
        public JsonResult UpdateCommand([DataSourceRequest] DataSourceRequest request, CategoryVewModel model)
        {
            if (ModelState.IsValid)
            {
                var entity = this.Data.Categories.GetById(model.Id);
                entity.Name = model.Name;
                this.Data.SaveChanges();
            }

            return Json(new[] { model }.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
        }
 public ActionResult CreateCommand([DataSourceRequest] DataSourceRequest request, CategoryVewModel model)
 {
     var entity = new Category();
     if (ModelState.IsValid)
     {
         entity.Name = model.Name;
         Data.Categories.Add(entity);
         this.Data.SaveChanges();
         model.Id = entity.Id;
     }
     return Json(new[] { model }.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
 }