Пример #1
0
        // GET: Roles/Details/5
        public ActionResult Details(int?id)
        {
            if (_rolesManager.SetCurrentEmployee(_employeeDataAccess, GetCurrentUserEmail()))
            {
                var accessLevel = _rolesManager.IdentifyRole();
                if (accessLevel == "FullAccess" || accessLevel == "FullView")
                {
                    if (id == null)
                    {
                        return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                    }

                    var role = _roleDataAccess.GetRoleById(id);
                    if (role == null)
                    {
                        return(HttpNotFound());
                    }

                    ViewBag.ProfilePic = _rolesManager.LoggedInEmployee.Profile.ProfilePic;
                    ViewBag.Access     = accessLevel;
                    return(View(role));
                }

                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"));
        }