Esempio n. 1
0
        public async Task <ActionResult <TblMaestro> > PostTblMaestro(TblMaestro tblMaestro)
        {
            _context.Maestros.Add(tblMaestro);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetTblMaestro", new { id = tblMaestro.IdMaestro }, tblMaestro));
        }
Esempio n. 2
0
        public async Task <IActionResult> PutTblMaestro(int id, TblMaestro tblMaestro)
        {
            if (id != tblMaestro.IdMaestro)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }