public async Task <IActionResult> PutBoodschap(int id, Boodschap boodschap) { if (id != boodschap.BoodschapID) { return(BadRequest()); } _context.Entry(boodschap).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BoodschapExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <Boodschap> > PostBoodschap(Boodschap boodschap) { _context.Boodschappen.Add(boodschap); await _context.SaveChangesAsync(); return(CreatedAtAction("GetBoodschap", new { id = boodschap.BoodschapID }, boodschap)); }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } Boodschap = await _context.Boodschappen.SingleOrDefaultAsync(m => m.Id == id); if (Boodschap == null) { return(NotFound()); } return(Page()); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Boodschap = await _context.Boodschappen.FindAsync(id); if (Boodschap != null) { _context.Boodschappen.Remove(Boodschap); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public BoodschapVM(Boodschap boodschap) { this.Naam = boodschap.Naam; this.Aantal = boodschap.Aantal; }