public async Task <IActionResult> Edit(int id, [Bind("Id,RoleGroupId,RoleId")] RoleCarryOuts roleCarryOuts) { if (id != roleCarryOuts.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(roleCarryOuts); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RoleCarryOutsExists(roleCarryOuts.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["RoleId"] = new SelectList(_context.Roles, "Id", "Description", roleCarryOuts.RoleId); ViewData["RoleGroupId"] = new SelectList(_context.RoleGroups, "Id", "Name", roleCarryOuts.RoleGroupId); return(View(roleCarryOuts)); }
public async Task <IActionResult> Create([Bind("Id,RoleGroupId,RoleId")] RoleCarryOuts roleCarryOuts) { if (ModelState.IsValid) { _context.Add(roleCarryOuts); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["RoleId"] = new SelectList(_context.Roles, "Id", "Description", roleCarryOuts.RoleId); ViewData["RoleGroupId"] = new SelectList(_context.RoleGroups, "Id", "Name", roleCarryOuts.RoleGroupId); return(View(roleCarryOuts)); }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } RoleCarryOuts = await _context.RoleCarryOuts .Include(r => r.Role) .Include(r => r.RoleGroup).FirstOrDefaultAsync(m => m.RoleGroupId == id); if (RoleCarryOuts == null) { return(NotFound()); } return(Page()); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } RoleCarryOuts = await _context.RoleCarryOuts.FindAsync(id); if (RoleCarryOuts != null) { _context.RoleCarryOuts.Remove(RoleCarryOuts); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } RoleCarryOuts = await _context.RoleCarryOuts .Include(r => r.Role) .Include(r => r.RoleGroup).FirstOrDefaultAsync(m => m.RoleGroupId == id); if (RoleCarryOuts == null) { return(NotFound()); } ViewData["RoleId"] = new SelectList(_context.Roles, "Id", "Description"); ViewData["RoleGroupId"] = new SelectList(_context.RoleGroups, "Id", "Name"); return(Page()); }