private void TransferVideoCategory() { var oldVideoCategories = _oldDbContext.VideoCategory.ToList(); var newVideoCategories = _newDbContext.VideoCategories.ToList(); foreach (var oldVideoCategory in oldVideoCategories) { var findVideoCategory = newVideoCategories.FirstOrDefault(vc => vc.Name == oldVideoCategory.Name); if (findVideoCategory == null) { var newVideoCategory = new VideoCategories() { Name = oldVideoCategory.Name, CreatedAt = oldVideoCategory.CreatedAt, UpdatedAt = oldVideoCategory.UpdatedAt, Image = oldVideoCategory.Image, Slug = oldVideoCategory.Slug, IsDeleted = false }; _newDbContext.VideoCategories.Add(newVideoCategory); _newDbContext.SaveChanges(); } } }
public static void AddFreeVideo(VideoCategories category) { Console.WriteLine("The free video added: " + category); }