Example #1
0
        public async Task <IActionResult> OnGetAsync(int userid)
        {
            try
            {
                // if no userid set to default user
                if (userid == 0)
                {
                    userid = 1;
                }

                // get all info for font page
                User = await _usersServices.GetUserById(userid);

                BoardsSelect = new SelectList(await _boardsServices.GetBoards(), "BoardId", "Title");
                Posts        = await _postsServices.GetTopTen();

                Boards = await _boardsServices.GetBoards();

                return(Page());
            }
            catch (Exception)
            {
                return(RedirectToPage("../Error"));
            }
        }
        public async Task <IActionResult> OnGetAsync()
        {
            try
            {
                Boards = await _boardsServices.GetBoards();

                return(Page());
            }
            catch (Exception)
            {
                return(RedirectToPage("../Error"));
            }
        }
Example #3
0
        public async Task <IActionResult> OnGetAsync(int userid)
        {
            try
            {
                User = await _usersServices.GetUserById(userid);

                Posts = await _postsServices.GetPostsFromUser(userid);

                Boards = await _boardsServices.GetBoards();

                return(Page());
            }
            catch (Exception)
            {
                return(RedirectToPage("../Error"));
            }
        }