// To protect from overposting attacks, enable the specific properties you want to bind to, for // more details, see https://aka.ms/RazorPagesCRUD. public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(Modul).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ModulExists(Modul.ModulId)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }
// To protect from overposting attacks, enable the specific properties you want to bind to, for // more details, see https://aka.ms/RazorPagesCRUD. public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.PersonModel.Add(PersonModel); await _context.SaveChangesAsync(); return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(string id) { if (id == null) { return(NotFound()); } PersonModel = await _context.PersonModel.FindAsync(id); if (PersonModel != null) { _context.PersonModel.Remove(PersonModel); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Modul = await _context.Modul.FindAsync(id); if (Modul != null) { _context.Modul.Remove(Modul); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }