public ActionResult Edit(int id) { ViewBag.Role = new SelectList(RoleRepo.Get(), "Id", "Name"); RoleViewModel model = RoleRepo.GetById(id); return(View("_Edit", model)); }
// 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())); }
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)); }
//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)); }
//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)); }
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" }))); } }
//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" }))); } }
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" }))); } }
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" }))); } }
public IEnumerable <Role> GetRoles() => _roleRepo.Get();
//GET : New Role public ActionResult Create() { ViewBag.Categories = new SelectList(RoleRepo.Get(), "Id", "Name"); return(PartialView("_Create", new RoleViewModel())); }
public ActionResult List() { return(PartialView("_List", RoleRepo.Get())); }
// GET: Role public ActionResult Index() { ViewBag.Role1 = new SelectList(RoleRepo.Get(), "Code", "Code"); ViewBag.Role2 = new SelectList(RoleRepo.Get(), "Name", "Name"); return(View()); }