public static int GetRunning(int id) { using (ALSIEntities ctx = new ALSIEntities()) { job_running running = (from c in ctx.job_running where c.ID == id select c).FirstOrDefault(); if (running != null) { return((int)running.running_number + 1); } return(-1); } }
public static void IncrementRunning(int id) { using (ALSIEntities ctx = new ALSIEntities()) { job_running running = (from c in ctx.job_running where c.ID == id select c).FirstOrDefault(); if (running != null) { running.running_number = running.running_number + 1; ctx.SaveChanges(); } } }
public void Update() { job_running existing = _repository.Find(x => x.ID == this.ID).FirstOrDefault(); if (existing != null) { _repository.Edit(existing, this); } else { _repository.Add(this); } }