Esempio n. 1
0
        public async Task <ActionResult <VoteCan> > PostVoteCan(VoteCan voteCan)
        {
            _context.VoteCan.Add(voteCan);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetVoteCan", new { id = voteCan.VoteCanID }, voteCan));
        }
Esempio n. 2
0
        public async Task <IActionResult> PutVoteCan(int id, VoteCan voteCan)
        {
            voteCan.VoteCanID = id;

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

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

            return(NoContent());
        }