Esempio n. 1
0
        public void SeedData()
        {
            if (IsEmpty().Result)
            {
                var turnOnTask = new ScheduledTask {
                    Name              = "TurnOn",
                    Status            = "on",
                    Action            = "turnOn",
                    Uri               = "http://192.168.8.133",
                    ExecutionTime     = DateTime.Now.AddHours(-14),
                    LastExecutionTime = DateTime.Now.AddHours(-14)
                };

                var turnOffTask = new ScheduledTask {
                    Name              = "TurnOff",
                    Status            = "off",
                    Action            = "turnOff",
                    Uri               = "http://192.168.8.133",
                    ExecutionTime     = DateTime.Now.AddHours(-1),
                    LastExecutionTime = DateTime.Now.AddHours(-1)
                };

                databaseContext.Add(turnOnTask);
                databaseContext.Add(turnOffTask);
            }
        }
Esempio n. 2
0
        public async Task <Response> AddTaskAsync(ScheduledTaskViewModel scheduledTaskViewModel)
        {
            var response = new Response();
            var result   = await databaseContext.Add(new ScheduledTask(scheduledTaskViewModel, false));

            response.Fetch(result);

            return(response);
        }
Esempio n. 3
0
 public void Add(T entity)
 {
     _db.Add(entity);
     _db.SaveChanges();
 }