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

            model.GridIndex = index;
            try {
                LookupService.DeleteMarketingGroup(id);
            } catch (Exception e1) {
                model.Error.SetError(e1);
            }
            return(Json(model, JsonRequestBehavior.AllowGet));
        }
Beispiel #2
0
        public MarketingGroupListModel FindMarketingGroupsListModel(int companyId, int index, int pageNo, int pageSize, string search)
        {
            var model = new MarketingGroupListModel();

            int  numValue = 0;
            bool bGotNum  = int.TryParse(search, out numValue);

            // Do a case-insensitive search
            model.GridIndex = index;
            var allItems = db.FindMarketingGroups(companyId, true)
                           .Where(mg => string.IsNullOrEmpty(search) ||
                                  (mg.MarketingGroupName != null && mg.MarketingGroupName.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);
        }