public ActionResult AllProposals() { List <Proposal> proposals = _context.Proposals.ToList(); string email = null; if (User.IsInRole(RoleName.ER)) { email = User.Identity.GetUserName(); } List <Proposal> toShow = new List <Proposal>(); foreach (Proposal p in proposals) { if (p.IsViewable(User.Identity.GetUserId(), email)) { toShow.Add(p); } } var viewModel = new ProposalsIndexViewModel { Proposals = toShow, Heading = "All Proposals", Count = toShow.Count() }; return(View("Index", viewModel)); }
public ActionResult InPrincipleApproval() { var proposals = _context.Proposals.Where(m => m.InPrincipalApproved == true).ToList(); string email = null; if (User.IsInRole(RoleName.ER)) { email = User.Identity.GetUserName(); } List <Proposal> toShow = new List <Proposal>(); foreach (Proposal p in proposals) { if (p.IsViewable(User.Identity.GetUserId(), email)) { toShow.Add(p); } } var viewModel = new ProposalsIndexViewModel { Proposals = toShow, Heading = "In-Principle Approval", Count = toShow.Count() }; return(View("Index", viewModel)); }
public ActionResult AllSubmitted() { var proposals = _context.Proposals.Where(m => m.Submitted == true).ToList(); string email = null; if (User.IsInRole(RoleName.ER)) { email = User.Identity.GetUserName(); } List <Proposal> toShow = new List <Proposal>(); foreach (Proposal p in proposals) { if (p.IsViewable(User.Identity.GetUserId(), email) && !p.HasFacultyApproval()) { toShow.Add(p); } } var viewModel = new ProposalsIndexViewModel { Proposals = toShow, Heading = "Awaiting Faculty Decision", Count = toShow.Count() }; return(View("Index", viewModel)); }
// GET: Proposal public ActionResult Index() { var proposals = _context.Proposals.ToList(); var viewModel = new ProposalsIndexViewModel { Proposals = proposals, Heading = "All Proposals In DB", Count = proposals.Count() }; return(View("Index", viewModel)); }