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