public IActionResult Edit(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, 3))
                {
                    if (designationManager.IsExists(id))
                    {
                        Designation designation = designationManager.GetById(id);
                        return(View(designation));
                    }
                    else
                    {
                        return(NotFound("404- Not Found"));
                    }
                }
                else
                {
                    return(NotFound("No Access"));
                }
            }
        }
        public IActionResult Edit(int id)
        {
            //edit
            if (id == null)
            {
                return(View(ViewData["Message"] = "Course Not Available"));
            }
            Designation designation = designationManager.GetById(id);

            if (designation != null)
            {
                return(View(designation));
            }
            return(NotFound("404- Not Found"));
        }
예제 #3
0
        public IActionResult Edit(int id)
        {
            var authData = HttpContext.Session.GetString("userInfo");

            if (authData != "")
            {
                User user = JsonConvert.DeserializeObject <User>(authData);

                if (userAccess.HasAccess(user.Id, -30, user.DesignationId))
                {
                    if (designationManager.IsDesignationExists(id))
                    {
                        Designation designation = designationManager.GetById(id);
                        return(View(designation));
                    }
                    else
                    {
                        return(NotFound("404 Not Found"));
                    }
                }
                else
                {
                    return(RedirectToAction("AccessDenied", "Home"));
                }
            }
            else
            {
                HttpContext.Session.SetString("userInfo", "");

                return(RedirectToAction("Login", "LogIn"));
            }
        }