Exemplo n.º 1
0
        public IActionResult Index()
        {
            Before();
            List <Category> categories = _categoriesProvider.GetCategories().Select(c =>
                                                                                    new Category(c.Id, c.Name, _newsProvider.GetPopularNewsForCategory(c.Id))).ToList();

            ViewBag.LastNews = _newsProvider.GetLastNews();
            return(View(categories));
        }
        public PartialViewResult SelectCategory()
        {
            var categoryList = _categoriesProvider.GetCategories();

            if (categoryList != null)
            {
                return(PartialView(categoryList));
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 3
0
        public async Task <UserProfile> GetAdminProfile(string id)
        {
            UserProfile profile = await GetContentManagerProfile(id);

            profile.Categories      = _categoriesProvider.GetCategories();
            profile.ContentManagers = (await _userManager.GetUsersInRoleAsync("ContentManager"))
                                      .Select(u => new ContentManager {
                Id = u.Id, FirstName = u.FirstName, LastName = u.LastName
            }).ToList();
            profile.ContentManagersRequests = (await Task.WhenAll(_requestProvider.GetList()
                                                                  .Select(async request => await _userManager.FindByIdAsync(request.Id))))
                                              .Select(u => new ContentManager {
                Id = u.Id, FirstName = u.FirstName, LastName = u.LastName
            }).ToList();
            return(profile);
        }
Exemplo n.º 4
0
 private void Before()
 {
     ViewBag.Categories = _categoriesProvider.GetCategories();
 }