public static void EnsureInDatabase(long id, Data.WaitlistDataContext _Db)
        {
            var corporation = _Db.Corporation.Find(id);

            if (corporation != null)
            {
                return;
            }

            var result = EsiWrapper.GetCorporation(id);

            corporation = new Corporation
            {
                Id         = id,
                Name       = result.Result.Name,
                AllianceId = result.Result.AllianceId
            };

            //Corporation is not in an alliance
            if (corporation.AllianceId != 0)
            {
                Alliance.EnsureInDatabase((int)corporation.AllianceId, _Db);
            }

            _Db.Add(corporation);
            _Db.SaveChanges();

            return;
        }
示例#2
0
        public static void EnsureInDatabase(int id, Data.WaitlistDataContext _Db)
        {
            var alliance = _Db.Alliance.Find(id);

            if (alliance != null)
            {
                return;
            }

            var result = EsiWrapper.GetAlliance(id);

            alliance = new Alliance
            {
                Id   = id,
                Name = result.Result.Name
            };

            _Db.Add(alliance);
            _Db.SaveChanges();

            return;
        }