public ActionResult Categories_Destroy([DataSourceRequest]DataSourceRequest request, ProductCategoriesViewModel category) { if (ModelState.IsValid) { var entity = new Category { Id = category.Id, Name = category.Name }; this.categories.Delete(entity.Id); } return Json(new[] { category }.ToDataSourceResult(request, ModelState)); }
public ActionResult Categories_Create([DataSourceRequest]DataSourceRequest request, ProductCategoriesViewModel category) { if (ModelState.IsValid) { var entity = new Category { Name = category.Name }; this.categories.AddCategory(entity); category.Id = entity.Id; } return Json(new[] { category }.ToDataSourceResult(request, ModelState)); }