예제 #1
0
        public async Task <IActionResult> PutPreventivoCorrectivo(int id, PreventivoCorrectivo preventivoCorrectivo)
        {
            if (id != preventivoCorrectivo.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
예제 #2
0
        public async Task <ActionResult <PreventivoCorrectivo> > PostPreventivoCorrectivo(PreventivoCorrectivo preventivoCorrectivo)
        {
            _context.PreventivoCorrectivo.Add(preventivoCorrectivo);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetPreventivoCorrectivo", new { id = preventivoCorrectivo.Id }, preventivoCorrectivo));
        }