public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(Lyric).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LyricExists(Lyric.id)) { return(NotFound()); } else { throw; } } return(RedirectToPage("/Index")); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } Lyric.owner_id = User.FindFirst(ClaimTypes.NameIdentifier).Value; _context.Lyric.Add(Lyric); await _context.SaveChangesAsync(); return(RedirectToPage("/Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Lyric = await _context.Lyric.FindAsync(id); if (Lyric != null) { _context.Lyric.Remove(Lyric); await _context.SaveChangesAsync(); } return(RedirectToPage("/Index")); }