示例#1
0
 public void DeleteAllByType(string type)
 {
     using (var ctx = new TasksDbContext())
     {
         ctx.Tasks.RemoveRange(ctx.Tasks);
         ctx.SaveChanges();
     }
 }
示例#2
0
        public void Add(string tasktype, string details, string worker)
        {
            using (var ctx = new TasksDbContext())
            {
                var t = new TaskEntity()
                {
                    ExecutionDT = DateTime.UtcNow,
                    TaskType    = tasktype,
                    Worker      = worker,
                    Details     = details
                };

                ctx.Tasks.Add(t);

                ctx.SaveChanges();
            }
        }