public bool Init(Tasks task) { bool result = false; using (JobsDBEntities entities = new JobsDBEntities()) { if (task != null) { entities.tasks.Add(task); entities.SaveChanges(); result = true; } } return(result); }
public bool Reject(int id) { bool result = false; using (JobsDBEntities entities = new JobsDBEntities()) { var task = this.GetJobById(id); if (task != null && task.TaskIsProcessed == true) { entities.Entry(task).State = System.Data.Entity.EntityState.Modified; task.TaskIsProcessed = false; task.TaskProcessedDate = DateTime.Now; entities.SaveChanges(); result = true; } } return(result); }