public async Task <IActionResult> PutcatCharge(string id, catCharge catCharge) { if (id != catCharge.ID) { return(BadRequest()); } _context.Entry(catCharge).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!catChargeExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <catCharge> > PostcatCharge(catCharge catCharge) { _context.catCharge.Add(catCharge); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (catChargeExists(catCharge.ID)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetcatCharge", new { id = catCharge.ID }, catCharge)); }