Beispiel #1
0
        public IActionResult Index(string searchText)
        {
            var           AllTickets   = ticketRepo.GetAllTickets();
            List <Ticket> ShownTickets = new List <Ticket>();

            if (!String.IsNullOrEmpty(searchText))
            {
                AllTickets = AllTickets.Where(t => t.Description.Contains(searchText)).ToList();
            }

            string         CureentUserID   = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.NameIdentifier).Value;
            BugTrackerUser CurrentUser     = userRepo.GetUserByID_IncludeManagedProject(CureentUserID);
            Role           CurrentUserRole = rolesManipulator.GetUserRoles(CureentUserID);

            if (CurrentUserRole.ID == RolesIDs.SubmitterID)
            {
                ShownTickets = AllTickets.Where(t => t.SubmitterID == CureentUserID).ToList();
            }
            if (CurrentUserRole.ID == RolesIDs.ManagerID)
            {
                ShownTickets = AllTickets.Where(t => t.ProjectID == CurrentUser.ManagedProject.ProjectID).ToList();
                return(View("ManagerTicketsIndex", ShownTickets));
            }
            if (CurrentUserRole.ID == RolesIDs.DeveloperID)
            {
                ShownTickets = AllTickets.Where(t => t.DeveloperID == CurrentUser.BugTrackerUserID).ToList();
                return(View("DeveloperTicketsIndex", ShownTickets));
            }

            return(View(ShownTickets));
        }
        public IActionResult Developer()
        {
            string        CurrentUserID  = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.NameIdentifier).Value;
            List <Ticket> RelatedTickets = ticketRepo.GetAllTickets().Where(t => t.DeveloperID == CurrentUserID).ToList();

            TicketsStatisticsModel TSM = new TicketsStatisticsModel
            {
                OpenTicketsCount       = RelatedTickets.Where(t => t.Status == StatusType.Open).Count(),
                InProgressTicketsCount = RelatedTickets.Where(t => t.Status == StatusType.InProgress).Count(),
                StrugglingTicketsCount = RelatedTickets.Where(t => t.Status == StatusType.Struggling).Count(),
                CompleteTicketCount    = RelatedTickets.Where(t => t.Status == StatusType.Complete).Count(),

                LowPriorityTicketsCount      = RelatedTickets.Where(t => t.Priority == PriorityType.Low).Count(),
                ModeratePriorityTicketsCount = RelatedTickets.Where(t => t.Priority == PriorityType.Moderate).Count(),
                HightPriorityTicketsCount    = RelatedTickets.Where(t => t.Priority == PriorityType.High).Count(),
                ExtremePriorityTicketsCount  = RelatedTickets.Where(t => t.Priority == PriorityType.Extreme).Count(),
            };

            return(View(TSM));
        }