// To protect from overposting attacks, please enable the specific properties you want to bind to, for // more details see https://aka.ms/RazorPagesCRUD. public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(Room).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RoomExists(Room.RoomID)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(string id) { if (id == null) { return(NotFound()); } Room = await _context.Room.FindAsync(id); if (Room != null) { _context.Database.ExecuteSqlRaw("GetOutFromRoom @p0, @p1", parameters: new[] { Current.UserID, Room.RoomID }); await _context.SaveChangesAsync(); } return(RedirectToPage("/MyRooms")); }