Ejemplo n.º 1
0
        public IActionResult Add()
        {
            var authData = HttpContext.Session.GetString("userInfo");

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

                if (userAccess.HasAccess(user.Id, 2, user.DesignationId))
                {
                    ViewBag.Projects = projectManager.GetProjectsForDropDown();
                    return(View());
                }
                else
                {
                    return(RedirectToAction("AccessDenied", "Home"));
                }
            }
            else
            {
                HttpContext.Session.SetString("userInfo", "");

                return(RedirectToAction("Login", "LogIn"));
            }
        }
Ejemplo n.º 2
0
        public IActionResult Save()
        {
            var authData = HttpContext.Session.GetString("userInfo");

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

                if (userAccess.HasAccess(user.Id, -30, user.DesignationId))
                {
                    return(View());
                }
                else
                {
                    return(RedirectToAction("AccessDenied", "Home"));
                }
            }
            else
            {
                HttpContext.Session.SetString("userInfo", "");

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