예제 #1
0
        public async Task <ActionResult <CursoItem> > PostCursoItem(CursoItem item)
        {
            _context.CursoItems.Add(item);
            await _context.SaveChangesAsync();

            return(CreatedAtAction(nameof(GetCursoItem), new { id = item.CursoId }, item));
        }
예제 #2
0
        public async Task <IActionResult> PutCursoItem(string cursoId, CursoItem item)
        {
            if (cursoId != item.CursoId)
            {
                return(BadRequest());
            }

            _context.Entry(item).State = EntityState.Modified;
            await _context.SaveChangesAsync();

            return(NoContent());
        }