コード例 #1
0
        // GET: Admin/ListUser
        public ActionResult Index(string SortOrder, string SortBy, string Page)
        {
            ViewBag.SortOrder = SortOrder;
            ViewBag.SortBy    = SortBy;
            var users = objBs.GetAll();

            switch (SortBy)
            {
            case "UserEmail":
                switch (SortOrder)
                {
                case "Asc":
                    users = users.OrderBy(x => x.UserEmail).ToList();
                    break;

                case "Desc":
                    users = users.OrderByDescending(x => x.UserEmail).ToList();
                    break;

                default:
                    break;
                }
                break;

            case "Role":
                switch (SortOrder)
                {
                case "Asc":
                    users = users.OrderBy(x => x.Role).ToList();
                    break;

                case "Desc":
                    users = users.OrderByDescending(x => x.Role).ToList();
                    break;

                default:
                    break;
                }
                break;

            default:
                users = users.OrderBy(x => x.UserEmail).ToList();
                break;
            }
            ViewBag.TotalPages = Math.Ceiling(objBs.GetAll().Count() / 10.0);
            int page = int.Parse(Page == null ? "1" : Page);

            ViewBag.Page = page;
            users        = users.Skip((page - 1) * 10).Take(10).ToList();

            return(View(users));
        }
コード例 #2
0
 // GET: User/URL
 public ActionResult Index()
 {
     ViewBag.CategoryId = new SelectList(objCatBs.GetAll().ToList(), "CategoryId", "CategoryName");
     ViewBag.UserId     = new SelectList(objUserBs.GetAll().ToList(), "UserId", "UserEmail");
     //LinkHubDbEntities db = new LinkHubDbEntities();
     //ViewBag.CategoryId = new SelectList(db.tbl_Category, "CategoryId", "CategoryName");
     return(View());
 }
コード例 #3
0
 public IHttpActionResult Get()
 {
     return(Ok(userObjBs.GetAll()));
 }