Example #1
0
        /// <summary>Creates a teams list including name as a search criteria.</summary>
        /// <param name="searchName">Name of searched <see cref="Team"/> instances.</param>
        /// <param name="page">Page number for pagination.</param>
        // GET: Admin/Team
        public IActionResult Index(string searchName, int page = 1)
        {
            var teams = _db.Teams.ToList();

            if (searchName != null)
            {
                teams = teams.Where(t => t.Name.ToLower().Contains(searchName.ToLower())).Select(t => t).ToList();
            }

            StringBuilder param = new StringBuilder();

            param.Append($"/Admin/Team/Index?page=:");
            param.Append("&searchName=");
            if (searchName != null)
            {
                param.Append(searchName);
            }

            TeamsListViewModel teamsListVM = new TeamsListViewModel()
            {
                Teams      = teams.Skip((page - 1) * PageSize).Take(PageSize).ToList(),
                SearchName = searchName,
                PagingInfo = new PagingInfo
                {
                    CurrentPage  = page,
                    ItemsPerPage = PageSize,
                    TotalItems   = teams.Count(),
                    urlParam     = param.ToString()
                }
            };

            return(View(teamsListVM));
        }
        public async Task <IActionResult> Index()
        {
            // Create View Model
            var model = new TeamsListViewModel
            {
                Teams           = await _dataService.GetAllTeamsAsync(),
                SelectedCountry = "All"
            };

            return(View(model));
        }
Example #3
0
        public PartialViewResult TeamsList()
        {
            TelimenaUser user  = this.work.Users.GetByPrincipal(this.User);
            var          teams = user.AssociatedDeveloperAccounts;
            var          model = new TeamsListViewModel();

            model.Teams = teams.Select(x => new TeamsMenuEntry()
            {
                TeamId = x.Id, TeamName = x.Name
            });
            return(this.PartialView("_TeamsList", model));
        }