public async Task <ActionResult <Formando> > PostFormando(Formando formando)
        {
            _context.Formando.Add(formando);
            await _context.SaveChangesAsync();

            return(CreatedAtAction(nameof(GetFormando), new { id = formando.FormandoId }, formando));
        }
        public async Task <IActionResult> PutFormando(int id, Formando formando)
        {
            if (id != formando.FormandoId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
예제 #3
0
        public async Task <IActionResult> Put(Formando formando)
        {
            _db.Entry(formando).State = EntityState.Modified;
            await _db.SaveChangesAsync();

            return(NoContent());
        }
예제 #4
0
        public async Task <IActionResult> Post(Formando formando)
        {
            _db.Add(formando);
            await _db.SaveChangesAsync();

            return(Ok(formando.ID));
        }
예제 #5
0
        public async Task <IActionResult> Delete(Guid id)
        {
            var formando = new Formando {
                ID = id
            };

            _db.Remove(formando);
            await _db.SaveChangesAsync();

            return(NoContent());
        }