public ActionResult Aside() { var asideViewModel = new AsideViewModel(); using (var context = new DataContext()) { asideViewModel.Advertising = context.Advertising.Where(a => a.Place == true).OrderByDescending(a => a.Create).Take(3).ToList(); asideViewModel.Books = context.Books.Include("Categories").OrderByDescending(b => b.View).ThenByDescending(b => b.Create).Take(8).ToList(); asideViewModel.Tags = context.ArticleTags.ToList(); asideViewModel.Articles = context.Articles.OrderByDescending(a => a.View).Take(5).ToList(); } return(PartialView(asideViewModel)); }
public ViewViewComponentResult Invoke() { AsideViewModel model = new AsideViewModel(); model.FTSAdmin = false; model.Customer = false; if (UserIdentityInfo.Roles.Contains(Roles.FTSAdmin)) { model.FTSAdmin = true; } if (UserIdentityInfo.Roles.Contains(Roles.Customer)) { model.Customer = true; var customer = _userService.GetAllCustomerUsers(k => k.Id == Convert.ToInt32(UserIdentityInfo.Id)).FirstOrDefault(); if (customer.Customer != null) { model.CustomerName = customer.Customer.DisplayName; } } return(View(model)); }