public ActionResult Index(int?IsActive, string id) { DistributorManagementModel model = new DistributorManagementModel(); try { //string alphabet = string.IsNullOrEmpty(id) ? "A" : id; string alphabet = string.IsNullOrEmpty(id) ? "" : id; model.Distributors = distributorManagementProvider.GetDistributorsList().Distributors.Where(aa => aa.DistributorName.StartsWith(alphabet)).ToList(); bool status = IsActive == 1 ? true : false; if (Request.IsAjaxRequest()) { if (IsActive != 0 && id == "") { model.Distributors = model.Distributors.Where(aa => aa.Status == Convert.ToInt32(status)).ToList(); return(PartialView("VUC_DistributorList", model.Distributors)); } else if (IsActive == null && id != "") { return(PartialView("VUC_DistributorList", model.Distributors)); } else if (IsActive == 0 && id != "") { return(PartialView("VUC_DistributorList", model.Distributors)); } else { model.Distributors = model.Distributors.Where(aa => aa.Status == Convert.ToInt32(status)).ToList(); return(PartialView("VUC_DistributorList", model.Distributors)); } } return(View(model)); } catch (Exception ex) { TempData["ActionResponse"] = ex.Message; return(View(model)); } }
public ActionResult DistributorSearch(DistributorManagementModel model) { if (model.DistributorName != null) { model.Distributors = distributorManagementProvider.GetDistributorsList().Distributors.Where(aa => (aa.DistributorName.ToUpper().StartsWith(model.DistributorName.ToUpper())) || (aa.DistributorCode.ToUpper().StartsWith(model.DistributorName.ToUpper()))).ToList(); return(View("Index", model)); } else { return(RedirectToAction("Index")); } }