コード例 #1
0
        public async Task <IActionResult> PutTodoItem(int id, PruebasTablas todoItem)
        {
            if (id != todoItem.Id)
            {
                return(BadRequest());
            }

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


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

            return(NoContent());
        }
コード例 #2
0
        public async Task <ActionResult <PruebasTablas> > PostTodoItem(PruebasTablas todoItem)
        {
            _context.PruebaTabla.Add(todoItem);
            await _context.SaveChangesAsync();

            //return CreatedAtAction("GetTodoItem", new { id = todoItem.Id }, todoItem);
            return(CreatedAtAction(nameof(GetTodoItem), new { id = todoItem.Id }, todoItem));
        }