Esempio n. 1
0
        public ActionResult Index()
        {
            {
                DashboardViewModel model = new DashboardViewModel();
                model.Id = User.Identity.GetUserId();
                var user = db.Users.Find(model.Id);
                model.Name     = user.FirstName + " " + user.LastName;
                model.Projects = user.Projects.Where(p => p.Archived == false).ToList();

                TicketsHelper helper = new TicketsHelper(db);
                model.Tickets = helper.GetUserTickets(model.Id).Where(t => t.Status != TicketStatus.Closed).OrderByDescending(t => t.Created).Take(5).ToList();
                return(View(model));
            }
        }
Esempio n. 2
0
        public ActionResult Index()
        {
            var userId  = User.Identity.GetUserId();
            var th      = new TicketsHelper(urh, db);
            var myRoles = urh.ListUserRoles(userId).ToList();
            var ticket  = th.GetUserTickets(User.Identity.GetUserId());

            if (myRoles.Any(role => role == "Admin,Project Manager"))
            {
                var tickets = db.Ticket.ToList();
                return(View(tickets));
            }
            else
            {
                return(View(ticket));
            }
        }