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.ID)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Room.Add(Room); await _context.SaveChangesAsync(); return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } Question.Room = await _context.Room.FirstOrDefaultAsync(m => m.ID == RoomID); Console.WriteLine(Question); _context.Question.Add(Question); await _context.SaveChangesAsync(); return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Vote = await _context.Vote.FindAsync(id); if (Vote != null) { _context.Vote.Remove(Vote); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }