private static int Start(StartOptions opts) { var ctx = new KeepItUpContext(); var match = ctx.Servers.FirstOrDefault(s => s.Name == opts.Name); if (match != null) { match.Enabled = true; } ctx.SaveChanges(); return(0); }
private static int RemoveServer(RemoveOptions opts) { var ctx = new KeepItUpContext(); var match = ctx.Servers.FirstOrDefault(s => s.Name == opts.Name); if (match != null) { ctx.Remove(match); } ctx.SaveChanges(); return(0); }
private static int Add(AddOptions opts) { var ctx = new KeepItUpContext(); ctx.Add(new Server { Name = opts.Name, HomePath = opts.HomePath, BasePath = opts.BasePath, Port = opts.Port }); ctx.SaveChanges(); return(0); }