Exemplo n.º 1
0
 private static void ExportGirlsFromMSSqlToMySql(GenericRepository<Girl> sqlGirlsRepo, GenericRepository<Girl> mySqlGirlsRepo)
 {
     var girlsFromMSsql = sqlGirlsRepo.GetAll().ToList();
     foreach (var girlFromMSsql in girlsFromMSsql.ToList())
     {
         var girl = new Girl()
         {
             FirstName = girlFromMSsql.FirstName,
             LastName = girlFromMSsql.LastName,
             Age = girlFromMSsql.Age,
             BreastSizeId = girlFromMSsql.BreastSizeId,
             HairColorId = girlFromMSsql.HairColorId,
             CityId = girlFromMSsql.CityId,
             PricePerHour = girlFromMSsql.PricePerHour,
             Features = girlFromMSsql.Features,
             CountyId = girlFromMSsql.CountyId,
             // City = girlFromMSsql.City,
             // Country = girlFromMSsql.Country
         };
         mySqlGirlsRepo.Add(girl);
         mySqlGirlsRepo.SaveChanges();
     }
 }
Exemplo n.º 2
0
        private static IEnumerable GetGirls(object[,] array)
        {
            var girlsArray = new List<Girl>();

            for (var row = 2; row <= array.GetLength(0); row++)
            {
                var girl = new Girl
                {
                    FirstName = array[row, 1].ToString(),
                    LastName = array[row, 2].ToString(),
                    Age = Convert.ToInt32(array[row, 3]),
                    BreastSizeId = GetBreastSizeType(array[row, 4].ToString()),
                    HairColorId = GetHairColorType(array[row, 5].ToString()),
                    CityId = 1,
                    CountyId = 1,
                    PricePerHour = Convert.ToInt32(array[row, 8])
                };

                girlsArray.Add(girl);
            }

            return girlsArray;
        }