public ActionResult UserDashboard()
        {
            var model = new UserModel();

            long id = SecurityHelper.GetUserId();

            if (id == 0)
            {
                return(RedirectToAction("NoAccess", "Account"));
            }



            //Verlofdagen over
            int TotalMinutes = _mutvacService.GetMinutesVacationByID(id);

            model.Time = (TotalMinutes / 60).ToString() + " uur" + " (" + (TotalMinutes / 480).ToString() + " dagen" + " & " + ((TotalMinutes % 480) / 60).ToString() + " uur) " + ((TotalMinutes % 480) % 60).ToString() + " minuten";

            //Verlofaanvragen
            //Verlof van vandaag
            model.VacationRequestToday = _vacreqService.GetCurrentVacation(id).ToPagedList(model.Page, model.PageSize);


            //Alle verlofaanvragen
            model.VacationRequest = _vacreqService.GetAll(id).ToPagedList(model.Page, model.PageSize);

            //Geaccepteerde verlofaanvragen
            model.VacationRequestAccepted = _vacreqService.GetAcceptedVacationBy3(id).ToPagedList(model.Page, model.PageSize);

            //Afgewezen verlofaanvragen
            model.VacationRequestRejected = _vacreqService.GetRejectedVacationBy3(id).ToPagedList(model.Page, model.PageSize);

            //Verlofaanvragen in behandeling
            model.VacationRequestInTreatment = _vacreqService.GetInTreatmentVacationBy3(id).ToPagedList(model.Page, model.PageSize);

            //Voorgestelde verlofverzoeken
            model.VacationRequestProposition = _vacreqService.GetPropositionVacationBy3(id).ToPagedList(model.Page, model.PageSize);

            //Gebruikersgegevens
            model.currentuser = _userService.GetById(id).ToPagedList(model.Page, model.PageSize);


            //Bijbehorende managerid van de huidige gebruiker
            long managerid = _userService.GetManageridByUserId(id);
            //Manager voor de huidige gebruiker
            long manageruserid = _manService.GetUserIDByManagerID(managerid);

            model.currentmanager = _userService.GetById(manageruserid).ToPagedList(model.Page, model.PageSize);


            return(View(model));
        }
        public ActionResult DetailsManager(long?userid)
        {
            if (userid != null)
            {
                var user = _userService.Get(userid.Value);

                if (SecurityHelper.UserHasRole(UserRoles.HRManager) || user.Manager == _manService.GetManageridByUserID(SecurityHelper.GetUserId()) || user.SecondManager == _manService.GetManageridByUserID(SecurityHelper.GetUserId()) || user.UserID == SecurityHelper.GetUserId())
                {
                    if (user.IsManager == true)
                    {
                        long currentmanagerid = _manService.GetManageridByUserID(userid.Value);
                        bool IsAvailable      = _manService.IsAvailable(currentmanagerid);

                        int mutvac = _mutvacService.GetMinutesVacationByID(userid.Value);

                        long managerid       = user.Manager;
                        long?secondmanagerid = user.SecondManager;

                        var manager = _userService.Get(_manService.GetUserIDByManagerID(managerid));

                        if (secondmanagerid != null)
                        {
                            var secondmanager      = _userService.Get(_manService.GetUserIDByManagerID(secondmanagerid.Value));
                            var secondmanagermodel = new EditModel(user, manager, secondmanager, mutvac, IsAvailable);

                            var Msg = TempData["Saved"] as string;
                            if (Msg != null && Msg == "true")
                            {
                                secondmanagermodel.HasSuccesMessage = true;
                            }
                            else
                            {
                                secondmanagermodel.HasSuccesMessage = false;
                            }

                            return(View(secondmanagermodel));
                        }


                        var model = new EditModel(user, manager, mutvac, IsAvailable);



                        return(View(model));
                    }

                    if (user.IsHRManager || user.IsMedewerker)
                    {
                        int mutvac = _mutvacService.GetMinutesVacationByID(userid.Value);

                        long managerid       = user.Manager;
                        long?secondmanagerid = user.SecondManager;

                        var manager = _userService.Get(_manService.GetUserIDByManagerID(managerid));

                        if (secondmanagerid != null)
                        {
                            var secondmanager      = _userService.Get(_manService.GetUserIDByManagerID(secondmanagerid.Value));
                            var secondmanagermodel = new EditModel(user, manager, secondmanager, mutvac, null);

                            var Message = TempData["Saved"] as string;
                            if (Message != null && Message == "true")
                            {
                                secondmanagermodel.HasSuccesMessage = true;
                            }
                            else
                            {
                                secondmanagermodel.HasSuccesMessage = false;
                            }
                            return(View(secondmanagermodel));
                        }


                        var model = new EditModel(user, manager, mutvac);

                        var Msg = TempData["Saved"] as string;
                        if (Msg != null && Msg == "true")
                        {
                            model.HasSuccesMessage = true;
                        }
                        else
                        {
                            model.HasSuccesMessage = false;
                        }

                        return(View(model));
                    }
                }



                return(RedirectToAction("NoAccess", "Account"));
            }

            return(RedirectToAction("IndexHR", "User"));
        }