Exemple #1
0
        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());
        }
Exemple #2
0
        public async Task <ActionResult <Boodschap> > PostBoodschap(Boodschap boodschap)
        {
            _context.Boodschappen.Add(boodschap);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetBoodschap", new { id = boodschap.BoodschapID }, boodschap));
        }
Exemple #3
0
        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());
        }
Exemple #4
0
        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;
 }