コード例 #1
0
        public async Task <ActionResult <Retos> > PostRetos(Retos retos)
        {
            _context.Retos.Add(retos);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetRetos", new { id = retos.IdReto }, retos));
        }
コード例 #2
0
        public async Task <IActionResult> PutRetos(int id, Retos retos)
        {
            if (id != retos.IdReto)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }