Exemplo n.º 1
0
        public IActionResult CreatePollScoringSystem([FromBody] PollScoringSystem item)
        {
            if (item == null)
            {
                return(BadRequest());
            }

            _context.PollScoringSystems.Add(item);
            _context.SaveChanges();

            return(CreatedAtRoute("GetPollScoringSystem", new { id = item.Id }, item));
        }
Exemplo n.º 2
0
        public IActionResult UpdatePollScoringSystem(int id, [FromBody] PollScoringSystem item)
        {
            if (item == null)
            {
                return(BadRequest());
            }

            var pollScoringSystem = _context.PollScoringSystems.FirstOrDefault(t => t.Id == id);

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

            pollScoringSystem.Description = item.Description;
            pollScoringSystem.ModifyDate  = DateTime.UtcNow;

            _context.PollScoringSystems.Update(pollScoringSystem);
            _context.SaveChanges();

            return(new NoContentResult());
        }