Пример #1
0
        public ActionResult Edit(int id)
        {
            ViewBag.Role = new SelectList(RoleRepo.Get(), "Id", "Name");
            RoleViewModel model = RoleRepo.GetById(id);

            return(View("_Edit", model));
        }
Пример #2
0
 // GET: User
 public ActionResult Index()
 {
     ViewBag.Employee = new SelectList(EmployeeRepo.Get(), "FullName", "FullName");
     ViewBag.Role     = new SelectList(RoleRepo.Get(), "Name", "Name");
     ViewBag.Company  = new SelectList(CompanyRepo.Get(), "Name", "Name");
     return(View(UserRepo.Get()));
 }
Пример #3
0
        public ActionResult Edit(int id)
        {
            ViewBag.Role     = new SelectList(RoleRepo.Get(), "Id", "Name");
            ViewBag.Employee = new SelectList(EmployeeRepo.Get(), "Id", "Fullname");
            UserViewModel model = UserRepo.GetById(id);

            return(PartialView("_Edit", model));
        }
Пример #4
0
        //GET: Create
        public ActionResult Create()
        {
            ViewBag.RoleMenu = new SelectList(RoleRepo.Get(), "Id", "Name");
            ViewBag.ListMenu = new SelectList(MenuRepo.Get(), "Id", "Name");
            MenuAccessViewModel model = new MenuAccessViewModel();

            return(PartialView("_Create", model));
        }
Пример #5
0
        //GET: Edit
        public ActionResult Edit(int id)
        {
            ViewBag.RoleMenu = new SelectList(RoleRepo.Get(), "Id", "Name");
            ViewBag.ListMenu = new SelectList(MenuRepo.Get(), "Id", "Name");
            ViewBag.IdMenu   = new SelectList(MenuRepo.Get(), "Id", "Id");
            MenuAccessViewModel model = MenuAccessRepo.GetById(id);

            return(PartialView("_Edit", model));
        }
Пример #6
0
        public ActionResult List()
        {
            UserViewModel access = DesignApproveRepo.GetIdByName(User.Identity.Name);

            if (access.Role == "Admin")
            {
                return(PartialView("_List", RoleRepo.Get()));
            }
            else
            {
                return(new RedirectToRouteResult(new RouteValueDictionary(new { controller = "AccessDenied", action = "Index" })));
            }
        }
Пример #7
0
        //GET : New Role
        public ActionResult Create()
        {
            ViewBag.Categories = new SelectList(RoleRepo.Get(), "Id", "Name");
            UserViewModel access = DesignApproveRepo.GetIdByName(User.Identity.Name);

            if (access.Role == "Admin")
            {
                return(PartialView("_Create", new RoleViewModel()));
            }
            else
            {
                return(new RedirectToRouteResult(new RouteValueDictionary(new { controller = "AccessDenied", action = "Index" })));
            }
        }
Пример #8
0
        public ActionResult Add()
        {
            UserViewModel result = UserRepo.GetIdByName(User.Identity.Name);

            ViewBag.Employee = new SelectList(UserRepo.GetEmp(), "Id", "Full_Name");
            ViewBag.Role     = new SelectList(RoleRepo.Get(), "Id", "Name");
            if (result.Role == "Admin")
            {
                return(PartialView("_Add", new RegisterViewModel()));
            }
            else
            {
                return(new RedirectToRouteResult(new RouteValueDictionary(new { controller = "AccessDenied", action = "Index" })));
            }
        }
Пример #9
0
        public ActionResult Edit(int id)
        {
            ViewBag.Role = new SelectList(RoleRepo.Get(), "Id", "Name");
            RoleViewModel model  = RoleRepo.GetById(id);
            UserViewModel access = DesignApproveRepo.GetIdByName(User.Identity.Name);

            if (access.Role == "Admin")
            {
                return(View("_Edit", model));
            }
            else
            {
                return(new RedirectToRouteResult(new RouteValueDictionary(new { controller = "AccessDenied", action = "Index" })));
            }
        }
Пример #10
0
 public IEnumerable <Role> GetRoles() => _roleRepo.Get();
Пример #11
0
 //GET : New Role
 public ActionResult Create()
 {
     ViewBag.Categories = new SelectList(RoleRepo.Get(), "Id", "Name");
     return(PartialView("_Create", new RoleViewModel()));
 }
Пример #12
0
 public ActionResult List()
 {
     return(PartialView("_List", RoleRepo.Get()));
 }
Пример #13
0
 // GET: Role
 public ActionResult Index()
 {
     ViewBag.Role1 = new SelectList(RoleRepo.Get(), "Code", "Code");
     ViewBag.Role2 = new SelectList(RoleRepo.Get(), "Name", "Name");
     return(View());
 }