public IHttpActionResult PostVaccine_Table(Vaccine_Table vaccine_Table) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Vaccine_Table.Add(vaccine_Table); try { db.SaveChanges(); } catch (DbUpdateException) { if (Vaccine_TableExists(vaccine_Table.Vaccine_nr)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = vaccine_Table.Vaccine_nr }, vaccine_Table)); }
public IHttpActionResult PutVaccine_Table(int id, Vaccine_Table vaccine_Table) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != vaccine_Table.Vaccine_nr) { return(BadRequest()); } db.Entry(vaccine_Table).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!Vaccine_TableExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetVaccine_Table(int id) { Vaccine_Table vaccine_Table = db.Vaccine_Table.Find(id); if (vaccine_Table == null) { return(NotFound()); } return(Ok(vaccine_Table)); }
public IHttpActionResult DeleteVaccine_Table(int id) { Vaccine_Table vaccine_Table = db.Vaccine_Table.Find(id); if (vaccine_Table == null) { return(NotFound()); } db.Vaccine_Table.Remove(vaccine_Table); db.SaveChanges(); return(Ok(vaccine_Table)); }