public ActionResult Index() { User currentUser = brioContext.CurrentUser; if (currentUser.RoleId != (int)Brio.Models.Roles.Admin) { return(RedirectToAction("Index", "Project")); } InfoCard currentUserInfoCard = infoCardRepository.GetUserInfoCard(brioContext.CurrentUser.ID); List <Division> divisions = divisionRepository.GetCompanyDivisions(currentUserInfoCard.CompanyId).ToList(); SelectList divisions_sel = new SelectList(divisions, "ID", "Name"); ViewBag.Divisions = divisions_sel; ViewBag.Roles = roleRepository.GetAll().ToList(); ViewBag.Admins = infoCardRepository.GetInfoCardsByRole(Roles.Admin, brioContext.CurrentUser.CompanyId); ViewBag.Clients = infoCardRepository.GetInfoCardsByRole(Roles.Client, brioContext.CurrentUser.CompanyId); ViewBag.Employees = infoCardRepository.GetInfoCardsByRole(Roles.Employee, brioContext.CurrentUser.CompanyId); ViewBag.ProjectManager = infoCardRepository.GetInfoCardsByRole(Roles.ProjectManager, brioContext.CurrentUser.CompanyId); ViewBag.IsSuccess = TempData["IsSuccess"]; ViewBag.Message = TempData["Message"]; ViewBag.UpdateAccount = TempData["UpdateAccount"] != null ? TempData["UpdateAccount"] : new EditPortalAccount(); if (TempData["Account"] != null) { return(View(TempData["Account"] as CreatePortalAccount)); } return(View()); }
public ActionResult Index() { IQueryable companies = companyRepository.GetAll(); SelectList companies_sel = new SelectList(companies, "ID", "CompanyName"); ViewBag.Companies = companies_sel; ViewBag.IsSuccess = TempData["IsSuccess"]; ViewBag.Message = TempData["Message"]; ViewBag.CreateDivision = TempData["CreateDivision"] != null ? TempData["CreateDivision"] : new CreateDivision(); return(View(divisionRepository.GetCompanyDivisions(brioContext.CurrentUser.CompanyId).ToList())); }