public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(KnowYourMeme).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!KnowYourMemeExists(KnowYourMeme.Genre)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.KnowYourMeme.Add(KnowYourMeme); await _context.SaveChangesAsync(); return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(string id) { if (id == null) { return(NotFound()); } KnowYourMeme = await _context.KnowYourMeme.FindAsync(id); if (KnowYourMeme != null) { _context.KnowYourMeme.Remove(KnowYourMeme); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }