public IHttpActionResult PutDatabaseJob(int id, DatabaseJob databaseJob) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != databaseJob.Id) { return(BadRequest()); } db.Entry(databaseJob).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!DatabaseJobExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetDatabaseJob(int id) { DatabaseJob databaseJob = db.DatabaseJobs.Find(id); if (databaseJob == null) { return(NotFound()); } return(Ok(databaseJob)); }
public IHttpActionResult PostDatabaseJob(DatabaseJob databaseJob) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.DatabaseJobs.Add(databaseJob); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = databaseJob.Id }, databaseJob)); }
public void ExectuteDatabaseJob(DatabaseJob job) { List <IDataParameter> parameters = new List <IDataParameter>(); if (job.Parameters != null) { foreach (T_Parameter param in job.Parameters) { parameters.Add(CreateParameter(param)); } } RunSp(job.executionString.ToString(), parameters); }
public IHttpActionResult DeleteDatabaseJob(int id) { DatabaseJob databaseJob = db.DatabaseJobs.Find(id); if (databaseJob == null) { return(NotFound()); } db.DatabaseJobs.Remove(databaseJob); db.SaveChanges(); return(Ok(databaseJob)); }