public ActionResult Delete(int index, int id)
        {
            var model = new BrandCategoryListModel();

            model.GridIndex = index;
            try {
                ProductService.DeleteBrandCategory(id);
            } catch (Exception e1) {
                model.Error.SetError(e1);
            }
            return(Json(model, JsonRequestBehavior.AllowGet));
        }
Example #2
0
        public BrandCategoryListModel FindBrandCategoriesListModel(int companyId, int index, int pageNo, int pageSize, string search)
        {
            var model = new BrandCategoryListModel();

            // Do a case-insensitive search
            model.GridIndex = index;
            var allItems = db.FindBrandCategories(companyId, true)
                           .Where(bc => string.IsNullOrEmpty(search) ||
                                  (bc.CategoryName != null && bc.CategoryName.ToLower().Contains(search.ToLower())));

            model.TotalRecords = allItems.Count();
            foreach (var item in allItems.Skip((pageNo - 1) * pageSize)
                     .Take(pageSize))
            {
                model.Items.Add(MapToModel(item));
            }
            return(model);
        }