public IActionResult PutBook(int id, [FromBody] Regions region) { if (id != region.RegionId) { return(BadRequest()); } try { _database.Entry(region).State = EntityState.Modified; _database.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!RegionExists(id)) { return(NotFound()); } else { throw; } } return(new JsonResult(new { message = "Updated" })); }
public IActionResult PutCategory(int id, [FromBody] AgeCategory cate) { if (id != cate.AgeCatId) { return(BadRequest()); } try { _database.Entry(cate).State = EntityState.Modified; _database.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!AgecatExists(id)) { return(NotFound()); } else { throw; } } return(new JsonResult(new { message = "Updated" })); }
public IActionResult PutGender(int id, [FromBody] Gender gender) { if (id != gender.GenId) { return(BadRequest()); } try { _database.Entry(gender).State = EntityState.Modified; _database.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!GenderExists(id)) { return(NotFound()); } else { throw; } } return(new JsonResult(new { message = "Updated" })); }
public IActionResult PutHelp(int id, [FromBody] HelpLines help) { if (id != help.HelpId) { return(BadRequest()); } try { _database.Entry(help).State = EntityState.Modified; _database.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!HelpExists(id)) { return(NotFound()); } else { throw; } } return(new JsonResult(new { message = "Updated" })); }
public IActionResult PutStat(int id, [FromBody] SmokerStat stat) { if (id != stat.SmokId) { return(BadRequest()); } try { _database.Entry(stat).State = EntityState.Modified; _database.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!SmokerExists(id)) { return(NotFound()); } else { throw; } } return(new JsonResult(new { message = "Updated" })); }