Пример #1
0
 public void CheckAgainstDatabase()
 {
     using (BLTContext context = new BLTContext())
     {
         var classes = context.Classes.ToList();
         foreach (ImportUser user in ImportData.Users)
         {
             var    namesplit  = user.Name.Split('-');
             string firstName  = namesplit[0];
             string serverName = namesplit[1];
             if (context.Characters.Any(c => firstName == c.Name && serverName == c.ServerName))
             {
                 user.IsInDatabase = true;
             }
         }
     }
 }
Пример #2
0
        internal static void Seed(BLTContext context)
        {
            while (context.Classes.Count() > 0)
            {
                context.Classes.Remove(context.Classes.First());
            }

            context.SaveChanges();

            foreach (string c in CLASSES)
            {
                context.Classes.Add(new CharacterClass()
                {
                    Name = c
                });
            }
            context.SaveChanges();
        }