public async Task <IActionResult> PutCatOpe(string id, CatOpe CatOpe) { if (id != CatOpe.CG_CATEOP) { return(BadRequest()); } _context.Entry(CatOpe).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CatOpeExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <CatOpe> > PostCatOpe(CatOpe CatOpe) { _context.CatOpe.Add(CatOpe); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (CatOpeExists(CatOpe.CG_CATEOP)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetCatOpe", new { id = CatOpe.CG_CATEOP }, CatOpe)); }