public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(Person).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PersonExists(Person.ID)) { return(NotFound()); } else { throw; } } Message = "Your changes have been saved."; return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(Song).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SongExists(Song.ID)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Song.Add(Song); await _context.SaveChangesAsync(); return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Person.Add(Person); await _context.SaveChangesAsync(); Message = $"{Person.FirstName} {Person.FamilyName} has been added"; return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Calendar = await _context.Calendar.FindAsync(id); if (Calendar != null) { _context.Calendar.Remove(Calendar); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Song = await _context.Song.FindAsync(id); if (Song != null) { _context.Song.Remove(Song); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(string id) { if (id == null) { return(NotFound()); } Person = await _context.Person.FindAsync(id); if (Person != null) { _context.Person.Remove(Person); await _context.SaveChangesAsync(); } Message = $"{Person.FirstName} {Person.FamilyName} has been deleted"; return(RedirectToPage("./Index")); }