Ejemplo n.º 1
0
        public async Task <IActionResult> PutTipoCelda(int id, TipoCelda TipoCelda)
        {
            if (id != TipoCelda.CG_TIPOCELDA)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Ejemplo n.º 2
0
        public async Task <ActionResult <TipoCelda> > PostTipoCelda(TipoCelda TipoCelda)
        {
            _context.TipoCelda.Add(TipoCelda);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (TipoCeldaExists(TipoCelda.CG_TIPOCELDA))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetTipoCelda", new { id = TipoCelda.CG_TIPOCELDA }, TipoCelda));
        }