示例#1
0
        // 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);
        }
示例#2
0
 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));
 }
示例#3
0
 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));
 }