// GET: Pool public async Task <ActionResult> Index() { var user = await _userManager.GetUserAsync(User); var pools = _context.PoolList.Where(x => x.UserId == user.Id).Include(x => x.Pool).ThenInclude(x => x.Teams).ThenInclude(x => x.User); PoolsViewModel poolsViewModel = new PoolsViewModel(); poolsViewModel.poolList = pools; ViewBag.Message = TempData["Message"]; return(View(poolsViewModel)); }
public JsonResult GetUserPools() { try { string userId = User.Identity.GetUserId(); List <PoolDTO> poolAsAdministrator = _poolManager.GetPoolOfUser(userId); List <PoolDTO> availablePools = _poolManager.GetAvailablePools(userId); PoolsViewModel poolsVM = new PoolsViewModel(); poolsVM.UserPools = poolAsAdministrator; poolsVM.AvailablePools = availablePools; JsonResult json = Json(poolsVM, JsonRequestBehavior.AllowGet); return(json); } catch (Exception excp) { } return(Json(false)); }