Exemplo n.º 1
0
        public async Task <IActionResult> PutTbPais(int id, TbPais tbPais)
        {
            if (id != tbPais.CodPais)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Exemplo n.º 2
0
        public async Task <ActionResult <TbPais> > PostTbPais(TbPais tbPais)
        {
            TbPais reg = new TbPais();

            reg.NomPais      = tbPais.NomPais;
            reg.EstadoActivo = tbPais.EstadoActivo;
            reg.Acronimo     = tbPais.Acronimo;

            _context.TbPais.Add(reg);
            await _context.SaveChangesAsync();


            return(CreatedAtAction("GetTbPais", new { id = reg.CodPais }, reg));
        }