示例#1
0
        public ActionResult Index(SurveyListViewModel model)
        {
            Session["CurrentPage"] = "SurveyIndex";
            model.UserId           = loggedInUserId;

            if (model != null && model.UserId > 0)
            {
                string[] pageConditions = { };
                if (HttpContext.Session["SurveyPagingCriteria"] != null)
                {
                    pageConditions = HttpContext.Session["SurveyPagingCriteria"].ToString().Split('|');
                    model.SortPageOptions.SortField   = pageConditions[(int)PageConditions.SortColumn].ToString();
                    model.SortPageOptions.SortOrder   = pageConditions[(int)PageConditions.SortOrder].ToString();
                    model.SortPageOptions.PageSize    = Convert.ToInt16(pageConditions[(int)PageConditions.PageSize]);
                    model.SortPageOptions.CurrentPage = Convert.ToInt16(pageConditions[(int)PageConditions.CurrentPage]);
                }
                else
                {
                    model.SortPageOptions.CurrentPage = 1;
                    model.SortPageOptions.PageSize    = LAMPConstants.LAMP_PAGE_SIZE;
                    model.SortPageOptions.SortField   = "SurveyName";
                    model.SortPageOptions.SortOrder   = "asc";
                }
            }
            SurveyListViewModel response = new SurveyListViewModel();

            response = _userService.GetSurveys(model);
            GetResponse(model, ref response);

            ModelState.Clear();
            return(View(response));
        }