public IActionResult Index() { var viewModel = new ViewModels.Account.IndexPage(); foreach (var user in AccountRepository) { if (user.DisplayName == "Deleted Account") { continue; } var indexItem = new ViewModels.Account.IndexItem { Id = user.Id, DisplayName = user.DisplayName, Email = user.Email, Registered = user.Registered.ToPassedTimeString(), LastOnline = user.LastOnline.ToPassedTimeString(), CanManage = UserContext.IsAdmin || user.Id == UserContext.ApplicationUser.Id }; viewModel.IndexItems.Add(indexItem); } return(ForumViewResult.ViewResult(this, viewModel)); }
public async Task <IActionResult> Index() { var viewModel = new ViewModels.Account.IndexPage(); foreach (var user in (await AccountRepository.Records()).Where(r => r.DisplayName != "Deleted Account")) { var indexItem = new ViewModels.Account.IndexItem { Id = user.Id, DisplayName = user.DisplayName, Email = user.Email, Registered = user.Registered.ToPassedTimeString(), LastOnline = user.LastOnline.ToPassedTimeString(), CanManage = UserContext.IsAdmin || user.Id == UserContext.ApplicationUser.Id }; viewModel.IndexItems.Add(indexItem); } return(View(viewModel)); }