Esempio n. 1
0
        public async Task <IViewComponentResult> InvokeAsync()
        {
            string          userName = contextAcc.HttpContext.User.Identity.Name;
            var             user     = repository.Employees.Single(e => e.EmployeeId == userName);
            List <MyErrand> errandList;

            //Skickar här även med all information om sökning och filtrering
            switch (user.RoleTitle)
            {
            case "Coordinator":
                errandList         = repository.CoordinatorErrandList(ViewBag.searchString, ViewBag.errandStatus, ViewBag.department);
                ViewBag.Controller = "Coordinator";
                ViewBag.Action     = "CrimeCoordinator";
                break;

            case "Manager":
                errandList         = repository.ManagerErrandList(user.DepartmentId, ViewBag.searchString, ViewBag.errandStatus, ViewBag.investigator);
                ViewBag.Controller = "Manager";
                ViewBag.Action     = "CrimeManager";
                break;

            case "Investigator":
                errandList         = repository.InvestigatorErrandList(user.DepartmentId, user.EmployeeId, ViewBag.searchString, ViewBag.errandStatus);
                ViewBag.Controller = "Investigator";
                ViewBag.Action     = "CrimeInvestigator";
                break;

            default:
                errandList = new List <MyErrand>();
                break;
            }


            return(View("ErrandList", errandList));
        }