コード例 #1
0
        public IActionResult Index(int order)
        {
            ViewBag.Order = new List <SelectListItem>()
            {
                new SelectListItem {
                    Value = "0", Text = "Sırala", Selected = true
                },
                new SelectListItem {
                    Value = "1", Text = "A"
                },
                new SelectListItem {
                    Value = "2", Text = "Z"
                },
            };
            var filterlist = _missionService.GetList().OrderByDescending(x => Guid.NewGuid());

            if (order == 1)
            {
                filterlist = filterlist.OrderBy(x => x.TaskName);
            }
            if (order == 2)
            {
                filterlist = filterlist.OrderByDescending(x => x.TaskName);
            }

            return(View(filterlist));
        }