Пример #1
0
        public IActionResult UserAccess(int id)
        {
            var employeeDataString = HttpContext.Session.GetString("employee");

            if (employeeDataString == "")
            {
                return(RedirectToAction("Login", "Auth"));
            }
            else
            {
                Employee employee = JsonConvert.DeserializeObject <Employee>(employeeDataString);

                if (userAccessManager.IsAccessExists(employee.Id, 4))
                {
                    if (employeeManager.IsIdExists(id))
                    {
                        ViewData["userId"]   = id;
                        ViewBag.UserAccesses = userAccessManager.GetAccessByUserId(id);

                        return(View());
                    }
                    else
                    {
                        return(NotFound("404- Not Found"));
                    }
                }
                else
                {
                    return(NotFound("No Access"));
                }
            }
        }