public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(Comment).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CommentExists(Comment.ID)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Accounts.Add(Account); await _context.SaveChangesAsync(); return(RedirectToPage("./Index")); }
public async Task OnPostAsync() { foreach (var item in Commentss) { _context.Comments.Update(item); _context.Entry(item).State = EntityState.Modified; } await _context.SaveChangesAsync(); Commentss = await _context.Comments .Include(c => c.Professor) .Where(x => !x.Verfied) .OrderBy(x => x.ProfessorID) .ToListAsync(); }
public async Task <IActionResult> OnPostAsync(Guid?id) { if (id == null) { return(NotFound()); } Course = await _context.Courses.FindAsync(id); if (Course != null) { _context.Courses.Remove(Course); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(Guid?id) { if (id == null) { return(NotFound()); } Professor = await _context.Professors.FindAsync(id); if (Professor != null) { _context.Professors.Remove(Professor); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(byte?id) { if (id == null) { return(NotFound()); } University = await _context.Universities.FindAsync(id); if (University != null) { _context.Universities.Remove(University); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }