예제 #1
0
        public int SaveJob(Job job)
        {
            int affectedRows = 0;

            using (ZavenContext context = new ZavenContext())
            {
                context.Jobs.Add(job);
                affectedRows = context.SaveChanges();
            }
            return(affectedRows);
        }
예제 #2
0
        public List <Job> GetAllJobs()
        {
            List <Job> sortedJobs = new List <Job>();

            using (ZavenContext context = new ZavenContext())
            {
                sortedJobs = context.Jobs.OrderBy(modificationDate => modificationDate.LastUpdatedAt).ToList();
                //jobs = sortedJobs.ToList();
            }
            return(sortedJobs);
        }
예제 #3
0
 public void Update(Job item)
 {
     using (ZavenContext context = new ZavenContext())
     {
         var entity = context.Jobs.Find(item.Id);
         if (entity == null)
         {
             return;
         }
         context.Entry(entity).CurrentValues.SetValues(item);
         context.SaveChanges();
     }
 }