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)); }
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)); }
public RoleRouteBuilder() { _roleRoute = new RoleRoute(); }