public IHttpActionResult PutImpactTempTable(int id, ImpactTempTable impactTempTable) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != impactTempTable.EmployeeID) { return(BadRequest()); } db.Entry(impactTempTable).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!ImpactTempTableExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetImpactTempTable(int id) { ImpactTempTable impactTempTable = db.ImpactTempTables.Find(id); if (impactTempTable == null) { return(NotFound()); } return(Ok(impactTempTable)); }
public IHttpActionResult DeleteImpactTempTable(int id) { ImpactTempTable impactTempTable = db.ImpactTempTables.Find(id); if (impactTempTable == null) { return(NotFound()); } db.ImpactTempTables.Remove(impactTempTable); db.SaveChanges(); return(Ok(impactTempTable)); }
public IHttpActionResult PostImpactTempTable(ImpactTempTable impactTempTable) { IEnumerable <ModelError> allErrors = ModelState.Values.SelectMany(v => v.Errors); if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.ImpactTempTables.Add(impactTempTable); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = impactTempTable.EmployeeID }, impactTempTable)); }