public IViewComponentResult Invoke(string email) { List <Project> projects = new List <Project>(); Client client = new Models.Client(); client = clientRepo.GetClientByEmail(email); if (client == null) { return(View(projects)); } else { projects = repository.GetAllProjectsByClientId(client.ClientID); return(View(projects)); } }
public async Task <IActionResult> UserPage() // get all the data for the user { UserIdentity user = new UserIdentity(); string name = HttpContext.User.Identity.Name; user = await userManager.FindByNameAsync(name); VMUserPage vm = new VMUserPage { User = user, }; vm.Client = clientRepo.GetClientByEmail(user.Email); vm.Bids = bidRepo.GetBidsByUserEmail(user.Email); if (vm.Client != null) { vm.Projects = projectRepo.GetAllProjectsByClientId(vm.Client.ClientID); vm.Invoices = invoiceRepo.GetAllInvoicesByClient(vm.Client); } return(View(vm)); }