예제 #1
0
        public ActionResult Edit([Bind(Include = @"Id,RoleId,RouteId")] RoleRoute roleRoute)
        {
            if (ModelState.IsValid)
            {
                _db.Entry(roleRoute).State = EntityState.Modified;
                _db.SaveChanges();
                return(RedirectToAction($"Index"));
            }
            ViewBag.RoleId  = new SelectList(_accessUtils.GetAreasAndRoles(), $"Id", $"Name", roleRoute.RoleId);
            ViewBag.RouteId = new SelectList(_accessUtils.GetRolesAndRoutes(), $"Id", $"Name", roleRoute.RouteId);

            return(View(roleRoute));
        }
예제 #2
0
        public ActionResult Create([Bind(Include = @"Id,RoleId,RouteId")] RoleRoute roleRoute)
        {
            if (ModelState.IsValid)
            {
                roleRoute.Id = Guid.NewGuid();
                _db.RoleRoutes.Add(roleRoute);
                _db.SaveChanges();
                return(RedirectToAction($"Index"));
            }

            ViewBag.RoleId  = new SelectList(_accessUtils.GetAreasAndRoles(), $"Id", $"Name", roleRoute.RoleId);
            ViewBag.RouteId = new SelectList(_accessUtils.GetRolesAndRoutes(), $"Id", $"Name", roleRoute.RouteId);

            return(View(roleRoute));
        }
예제 #3
0
 public RoleRouteBuilder()
 {
     _roleRoute = new RoleRoute();
 }