public async Task <IActionResult> Index() { var userId = this.userManager.GetUserId(this.User); var user = await this.userManager.FindByIdAsync(userId); var hasStripe = !string.IsNullOrWhiteSpace(user.StripeConnectedAccountId); var userPayments = await this.paymentService.GetManagerPaymentsListAsync(userId); var managedProperties = await this.listingService.GetManagedPropertiesAsync(userId); var viewModel = new ManagerDashboardViewModel { HasStripeAccount = hasStripe, ManagedProperties = managedProperties, Payments = userPayments, }; return(this.View(viewModel)); }
public ActionResult ManagerDashboard() { string userId = User.Identity.GetUserId(); ApplicationUser currentUser = db.Users.Include(u => u.Projects).First(u => u.Id == userId); var projects = new List <Project>(); projects = currentUser.Projects.Where(p => p.Priority != null).OrderByDescending(p => (int)p.Priority).ToList(); var projectsNull = new List <Project>(); projectsNull = currentUser.Projects.Where(p => p.Priority == null).ToList(); projects.AddRange(projectsNull); ManagerDashboardViewModel viewModel = new ManagerDashboardViewModel(); viewModel.Projects = projects; //currentUser.Projects.OrderByDescending(p => (int)p.Priority).ToList(); viewModel.NumOfUnreadNotifications = NotificationHelper.NumOfUnopenedNotifications(currentUser); viewModel.UserId = userId; return(View(viewModel)); }