public IActionResult Index(int Id = 0)
        {
            var store = new Store_VM();

            ViewBag.Clients      = new SelectList(_clientRepository.GetList(loginUserId).Where(x => x.Status).ToList(), "Id", "CompanyName");
            ViewBag.ConceptsList = new SelectList(_conceptsRepository.GetList(loginUserId).Where(x => x.Active && x.ClientId == 0), "Id", "ConceptName");
            ViewBag.CountryList  = new SelectList(_countryRepository.GetList().Where(x => x.Status), "CountryID", "Name");
            ViewBag.RegionList   = new SelectList(_regionRepository.GetList().Where(x => x.Status), "RegionId", "Region");

            if (Id > 0)
            {
                store = _storesRespository.Get(Id, loginUserId);
                if (store == null)
                {
                    return(RedirectToAction("List", "Stores"));
                }
                else
                {
                    ViewBag.ConceptsList = new SelectList(_conceptsRepository.GetList(loginUserId).Where(x => x.Active && x.ClientId == store.ClientId), "Id", "ConceptName");
                    ViewData["Title"]    = "Edit";
                    return(View(store));
                }
            }
            else
            {
                ViewData["Title"] = "Add";
                return(View(store));
            }
        }
        public IActionResult GetList(DataTableAjaxPostModel param)
        {
            int recordsTotal = 0;
            var result       = _conceptsRepository.GetList(loginUserId);

            if (result.Any())
            {
                recordsTotal = result.Count;
                if (param.status == Helper.Active)
                {
                    result = result.Where(x => x.Active).ToList();
                }
                else if (param.status == Helper.Inactive)
                {
                    result = result.Where(x => !x.Active).ToList();
                }

                if (!string.IsNullOrEmpty(param.search.value))
                {
                    var search = param.search.value;
                    result = result.Where(x => x.ConceptName.ToLower().Contains(search.ToLower()) ||
                                          x.ClientName.ToLower().Contains(search.ToLower())).ToList();
                }
            }

            string order    = Convert.ToString(param.order[0].column);
            string orderDir = param.order[0].dir;

            switch (order)
            {
            case "0":
                result = orderDir.Equals("DESC", StringComparison.CurrentCultureIgnoreCase) ? result.OrderByDescending(p => p.ConceptName).ToList() : result.OrderBy(p => p.ConceptName).ToList();
                break;

            case "1":
                result = orderDir.Equals("DESC", StringComparison.CurrentCultureIgnoreCase) ? result.OrderByDescending(p => p.ClientName).ToList() : result.OrderBy(p => p.ClientName).ToList();
                break;

            default:
                result = result.OrderByDescending(p => p.Id).ToList();
                break;
            }

            var data = result;

            if (param.length > 0)
            {
                data = result.Skip(param.start).Take(param.length).ToList();
            }

            return(Json(new
            {
                draw = param.draw,
                recordsFiltered = result.Count,
                recordsTotal = recordsTotal,
                data = data
            }));
        }