Exemple #1
0
        public IActionResult PutVote([FromBody] VoteDto vote)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            //if (id != vote.Id)
            //{
            //    return BadRequest();
            //}

            var updatedVote = _voteRepository.AddorUpdateVote(vote);

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

            return(Ok(updatedVote));
        }