public void Edit(CategoryViewModel post)
 {
     var cat = Get(post.ID);
     cat.CatType =post.CatType;
     cat.CatDescription = post.CatDescription;
     cat.CategoryName = post.CategoryName;
     cat.Sequance = post.Sequance;
     db.Entry(cat).State = System.Data.Entity.EntityState.Modified;
     db.SaveChanges();
 }
        public ActionResult Editing_Destroy([DataSourceRequest] DataSourceRequest request, CategoryViewModel cat)
        {
            if (cat != null)
            {
                var item = _repository.Get(cat.ID);
                _repository.Delete(item);
            }

            return Json(ModelState.ToDataSourceResult());
        }
 public void Create(CategoryViewModel post)
 {
     Category cat = new Category();
     cat.Sortindex = cat.ID + 1;
     cat.CatType = post.CatType;
     cat.CatDescription = post.CatDescription;
     cat.CategoryName = post.CategoryName;
     cat.Sequance = post.Sequance;
     db.Categories.Add(cat);
     db.SaveChanges();
 }
        public ActionResult Editing_Create([DataSourceRequest] DataSourceRequest request, CategoryViewModel cat)
        {
            var results = new List<CategoryViewModel>();

            if (cat != null && ModelState.IsValid)
            {

                _repository.Create(cat);
                cat.ID = _repository.Categories.First().ID;
                results.Add(cat);
            }

            return Json(results.ToDataSourceResult(request, ModelState));
        }
        public ActionResult Editing_Update([DataSourceRequest] DataSourceRequest request, CategoryViewModel cat)
        {
            if (cat != null && ModelState.IsValid)
            {

                    _repository.Edit(cat);
            }

            return Json(ModelState.ToDataSourceResult());
        }