Ejemplo n.º 1
0
        public async Task <IActionResult> PutPoll(long id, Poll poll)
        {
            if (id != poll.PollID)
            {
                return(BadRequest());
            }

            _context.Entry(poll).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PollExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <IActionResult> PutGebruiker(long id, Gebruiker gebruiker)
        {
            if (id != gebruiker.GebruikerID)
            {
                return(BadRequest());
            }

            _context.Entry(gebruiker).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!GebruikerExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> PutVriend(long id, Vriend vriend)
        {
            if (id != vriend.VriendID)
            {
                return(BadRequest());
            }

            _context.Entry(vriend).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!VriendExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Ejemplo n.º 4
0
        public async Task <ActionResult <Stem> > DeleteStemByGebruikerIDAndPollID(long GebruikerID, long pollOptieID)
        {
            var stem = await _context.Stemmen.Where(s => s.GebruikerID == GebruikerID && s.PollOptieID == pollOptieID).FirstOrDefaultAsync();

            if (stem == null)
            {
                return(NotFound());
            }

            _context.Stemmen.Remove(stem);
            await _context.SaveChangesAsync();

            return(stem);
        }