Exemple #1
0
        public async Task <ActionResult <PollMember> > PostPollMember(PollMember pollMember)
        {
            _context.PollMembers.Add(pollMember);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetPollMember", new { id = pollMember.PollMemberID }, pollMember));
        }
Exemple #2
0
        public async Task <IActionResult> PutPollMember(long id, PollMember pollMember)
        {
            if (id != pollMember.PollMemberID)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }