public async Task <IActionResult> Edit(int id, [Bind("ID,Name")] Category category) { if (id != category.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(category); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CategoryExists(category.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(category)); }
public async Task <IActionResult> Edit(int id, [Bind("Label,Capacity,Price,Description,CreateDate,UserID,ID,Deleted")] Room room) { if (id != room.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(room); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RoomExists(room.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["UserID"] = new SelectList(_context.Users, "ID", "Lastname", room.UserID); return(View(room)); }