public Task <bool> Save(BankInfo info) { return(Task.Run(() => { _context.Add(info); _context.SaveChanges(); return true; })); }
public ConnectionContext(IPAddress address, ushort port, IContextManager manager) : base(manager) { Connection = new Connection(Guid.NewGuid(), "nin0", address, port, new ConsoleLogger("console", (m, lvl) => lvl >= LogLevel.Information, true)); Connection.OnLoggedIn += (sender, args) => { Console.WriteLine("SERVER: " + args.Motd); Console.WriteLine($"SERVER: Available game modes: {string.Join("|", args.GameModes)}"); ContextManager.Add(new MainContext(ContextManager, args.Queuer, args.GameModes)); }; Connection.OnIllegalAction += (sender, s) => Console.WriteLine("ILLEGAL: " + s.Message); //Connection.OnKicked += (sender, s) => //{ // Console.WriteLine("KICKED: " + s.Message); // Debugger.Break(); // Environment.Exit(0); //}; }
public void AddToContext <TEntity>(IEnumerable <TEntity> entities) where TEntity : class { ContextManager.Add(entities); SaveAllChanges(); }
public void AddToContext <TEntity>(TEntity entity) where TEntity : class { ContextManager.Add(entity); SaveAllChanges(); }