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); } }
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); }
public void Add(T entity) { _db.Add(entity); _db.SaveChanges(); }