コード例 #1
0
        public ActionResult Index(int?IsActive, string id)
        {
            TravelSession obj      = (TravelSession)Session["TravelPortalSessionInfo"];
            string        alphabet = string.IsNullOrEmpty(id) ? "A" : id;
            var           model    = _rep.GetAllAgentByPaging().Where(aa => aa.AgentName.StartsWith(alphabet)).ToList();
            bool          status   = IsActive == 1 ? true : false;

            if (Request.IsAjaxRequest())
            {
                if (IsActive != 0 && id == "")
                {
                    model = model.Where(aa => aa.AgentStatus == status).ToList();
                    return(PartialView("AgentListPartial", model));
                }
                else if (IsActive == null && id != "")
                {
                    return(PartialView("AgentListPartial", model));
                }
                else if (IsActive == 0 && id != "")
                {
                    return(PartialView("AgentListPartial", model));
                }
                else
                {
                    //  return PartialView("AgentListPartial", model);
                    model = model.Where(aa => aa.AgentStatus == status).ToList();
                    return(PartialView("AgentListPartial", model));
                }
            }

            return(View(model));
        }
コード例 #2
0
        public ActionResult Index(int?IsActive, string id)
        {
            TravelSession obj      = SessionStore.GetTravelSession();
            string        alphabet = string.IsNullOrEmpty(id) ? "" : id;
            var           model    = _rep.GetAllAgentByPaging().Where(aa => aa.AgentName.StartsWith(alphabet)).Where(x => x.DistributorId == obj.LoginTypeId).ToList();
            //var model = _rep.GetAllAgentByPaging().Where(aa => aa.AgentName.StartsWith(alphabet)).Where(x => x.DistributorId == obj.AgentId).ToList();
            bool status = IsActive == 1 ? true : false;

            if (Request.IsAjaxRequest())
            {
                if (IsActive != 0 && id == "")
                {
                    model = model.Where(aa => aa.AgentStatus == status).ToList();
                    return(PartialView("AgentListPartial", model));
                }
                else if (IsActive == null && id != "")
                {
                    return(PartialView("AgentListPartial", model));
                }
                else if (IsActive == 0 && id != "")
                {
                    return(PartialView("AgentListPartial", model));
                }
                else
                {
                    model = model.Where(aa => aa.AgentStatus == status).ToList();
                    return(PartialView("AgentListPartial", model));
                }
            }

            return(View(model));
        }