// GET: Reservations/Approve public async Task <Status> Approve(int?id) { Reservation reservation = await _context.Reservations.FirstOrDefaultAsync(s => s.Id == id); if (ModelState.IsValid) { reservation.Status = Status.Approved; _context.Update(reservation); await _context.SaveChangesAsync(); } return(reservation.Status); }
public async Task <IActionResult> Edit(int id, [Bind("RoleId, Name, Email, Password")] User user) { user.Id = id; if (ModelState.IsValid) { try { _context.Update(user); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UserExists(id)) { return(NotFound()); } else { throw; } } return(Redirect($"/Users/Details/{id}")); } ViewData["Roles"] = new SelectList(_context.Roles, "Id", "Name"); return(View(user)); }
public async Task <IActionResult> Edit([Bind("Id,Name,Descrtiption,Seats,Projector,Board")] Room room) { if (ModelState.IsValid) { try { _context.Update(room); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RoomExists(room.Id)) { return(NotFound()); } else { throw; } } return(Redirect($"/Rooms/Details/{room.Id}")); } return(View(room)); }