Esempio n. 1
0
        public async Task <IActionResult> PutTipoArea(int id, TipoArea TipoArea)
        {
            if (id != TipoArea.CG_TIPOAREA)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Esempio n. 2
0
        public async Task <ActionResult <TipoArea> > PostTipoArea(TipoArea TipoArea)
        {
            _context.TipoArea.Add(TipoArea);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (TipoAreaExists(TipoArea.CG_TIPOAREA))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetTipoArea", new { id = TipoArea.CG_TIPOAREA }, TipoArea));
        }