// GET: Employees/Create
        public ActionResult Create()
        {
            if (_rolesManager.SetCurrentEmployee(_employeeDataAccess, GetCurrentUserEmail()))
            {
                if (_rolesManager.IdentifyRole() == "FullAccess")
                {
                    ViewBag.WorkloadsList  = new SelectList(_workloadDataAccess.GetAllWorkloads(), "Id", "Name");
                    ViewBag.RolesList      = new SelectList(_roleDataAccess.GetAllRoles(), "Id", "Title");
                    ViewBag.ProfilePic     = _rolesManager.LoggedInEmployee.Profile.ProfilePic;
                    ViewBag.Access         = TempData["AccessLevel"] = "FullAccess";
                    TempData["ProfilePic"] = _rolesManager.LoggedInEmployee.Profile.ProfilePic;

                    return(View());
                }

                ViewBag.ErrorMsg = "You are not authorized to view this page";
                return(View("Error"));
            }

            ViewBag.ErrorMsg = "You are not registered on our system. Plz contact the system administrator if u think this is wrong.";
            return(View("Error"));
        }
Beispiel #2
0
        public ActionResult Index()
        {
            if (_rolesManager.SetCurrentEmployee(_employeeDataAccess, GetCurrentUserEmail()))
            {
                var accessLevel = _rolesManager.IdentifyRole();
                if (accessLevel == "FullAccess" || accessLevel == "FullView")
                {
                    ViewBag.ProfilePic = _rolesManager.LoggedInEmployee.Profile.ProfilePic;
                    ViewBag.Access     = accessLevel;
                    return(View(_roleDataAccess.GetAllRoles()));
                }

                ViewBag.ErrorMsg = "You are not authorized to view this page";
                return(View("Error"));
            }

            ViewBag.ErrorMsg = "You are not registered on our system. Plz contact the system administrator if u think this is wrong.";
            return(View("Error"));
        }