コード例 #1
0
ファイル: RoleController.cs プロジェクト: Batch-167/marcom167
        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
ファイル: RoleController.cs プロジェクト: Batch-167/marcom167
 //GET : New Role
 public ActionResult Create()
 {
     ViewBag.Categories = new SelectList(RoleRepo.Get(), "Id", "Name");
     return(PartialView("_Create", new RoleViewModel()));
 }
コード例 #12
0
ファイル: RoleController.cs プロジェクト: Batch-167/marcom167
 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());
 }