Example #1
0
        /// <summary>
        /// Allows an admin user to view all users
        /// </summary>
        /// <param name="adminId"></param>
        private void ViewAllUsers(int adminId)
        {
            WebbShopAPI api         = new WebbShopAPI();
            var         listOfUsers = api.ListUsers(adminId);

            if (listOfUsers != null)
            {
                var sortUserList = listOfUsers.OrderBy(u => u.ID).ToList();
                AdminView.DisplayUsers(sortUserList);
                return;
            }

            MessageViews.DisplayErrorMessage();
        }
Example #2
0
        /// <summary>
        /// Allows an admin user to find another user
        /// </summary>
        /// <param name="adminId"></param>
        private void FindUser(int adminId)
        {
            AdminView.SearchPage();
            var keyword = Console.ReadLine();

            if (keyword != "")
            {
                WebbShopAPI api         = new WebbShopAPI();
                var         listOfUsers = api.FindUser(adminId, keyword);
                if (listOfUsers != null)
                {
                    var sortUserList = listOfUsers.OrderBy(u => u.ID).ToList();
                    AdminView.DisplayUsers(sortUserList);
                    return;
                }
            }

            MessageViews.DisplayErrorMessage();
        }