Example #1
0
        public async Task <IActionResult> PutLineas(int id, Lineas Lineas)
        {
            if (id != Lineas.CG_LINEA)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Example #2
0
        public async Task <ActionResult <Lineas> > PostLineas(Lineas Lineas)
        {
            _context.Lineas.Add(Lineas);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (LineasExists(Lineas.CG_LINEA))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetLineas", new { id = Lineas.CG_LINEA }, Lineas));
        }