Ejemplo n.º 1
0
        private void AddIfNotExists(LK_PhoneType phoneType)
        {
            if (_context.LK_PhoneType.Any(l => l.phoneType == phoneType.phoneType))
            {
                return;
            }

            _context.LK_PhoneType.Add(phoneType);

            _context.SaveChanges();
        }
Ejemplo n.º 2
0
        private void CreateLanguages()
        {
            List <LK_PhoneType> InitialPhoneType = new List <LK_PhoneType>();
            List <String>       listPhoneType    = new List <string>()
            {
                "1,Home Phone  ,   Residential Phone",
                "2,Business Phone  ,   Mobile Phone",
                "3,Hand Phone  ,   Mobile Phone",
                "4,Fax ,   NULL",
                "5,Bill Phone  ,   Residential Phone",
                "6,Hand Phone 2    ,   Mobile Phone",
                "7,Hand Phone 3    ,   Mobile Phone",
                "8,HP Subscription ,   Mobile Phone",
                "9,CDMA Phone  ,   Mobile Phone",
                "A,Home Phone 2    , Residential Phone"
            };

            foreach (var item in listPhoneType)
            {
                var phoneTypeSeparate = item.Split(',');

                var phoneTypePush = new LK_PhoneType()
                {
                    phoneType           = phoneTypeSeparate[0],
                    phoneTypeName       = phoneTypeSeparate[1],
                    phoneTypeNameProInt = phoneTypeSeparate[2]
                };

                InitialPhoneType.Add(phoneTypePush);
            }

            foreach (var phoneType in InitialPhoneType)
            {
                AddIfNotExists(phoneType);
            }
        }