Beispiel #1
0
 public ActionResult Leaderboard()
 {
     IDAL DAL = new DBDataAL();
     IEnumerable<User> users = DAL.GetAllUsers();
     Leaderboard board = new Leaderboard();
     board.IsGlobal = true;
     board.Users = users;
     return View(board);
 }
        public ActionResult SortByDefenseAscending(bool isGlobal)
        {
            IDAL DAL = new DBDataAL();
            Leaderboard board = new Leaderboard();
            board.IsGlobal = isGlobal;
            IEnumerable<User> users;
            if (isGlobal)
            {
                users = DAL.GetAllUsers().OrderBy(x => x.HighDefense);
            }
            else
            {
                string userName = User.Identity.Name;
                User currentUser = DAL.GetUser(userName);
                IEnumerable<string> friends = DAL.GetFriends(currentUser);
                users = DAL.GetAllUsers().Where(x => friends.Contains(x.UserName)).OrderBy(x => x.HighDefense);

            }
            board.Users = users;
            return View("~/Views/Web/Leaderboard.cshtml", board);
        }
 public ActionResult Leaderboard()
 {
     IDAL DAL = new DBDataAL();
     IEnumerable<User> users = DAL.GetAllUsers();
     return View(users);
 }
 public ActionResult SwitchToGlobal()
 {
     Leaderboard board = new Leaderboard();
     board.IsGlobal = true;
     IDAL DAL = new DBDataAL();
     board.Users = DAL.GetAllUsers();
     return View("~/Views/Web/Leaderboard.cshtml", board);
 }
 public ActionResult SwitchToFriends()
 {
     Leaderboard board = new Leaderboard();
     board.IsGlobal = false;
     IDAL DAL = new DBDataAL();
     User currentUser = DAL.GetUser(User.Identity.Name);
     IEnumerable<string> friends = DAL.GetFriends(currentUser);
     IEnumerable<User> users = DAL.GetAllUsers().Where(x => friends.Contains(x.UserName));
     return View("~/Views/Web/Leaderboard.cshtml", board);
 }