public static void Initial(AppDbContent content) { if (!content.Category.Any()) { content.Category.AddRange(Categories.Select(c => c.Value)); } if (!content.News.Any()) { content.AddRange( new News { name = "Выборы США", AuthorName = "Пушкин А.С.", Desc = "asfasfasfasfasfasfasfasf", date = "17.11.2020", isFavourite = true, img = "/img/default.jpg", Category = Categories["Политика"] }, new News { name = "Кто-то вмер", AuthorName = "newnews", Desc = "asfasfasfasfasfasfasfasf", date = "13.11.2020", isFavourite = true, img = "/img/default.jpg", Category = Categories["Политика"] }, new News { name = "Короновирус", AuthorName = "Короновирус", Desc = "asfasfasfasfasfasfasfasf", date = "15.11.2020", isFavourite = true, img = "/img/default.jpg", Category = Categories["Политика"] }, new News { name = "Рубль укрепился", AuthorName = "Путин", Desc = "asfasfasfasfasfasfasfasf", date = "15.11.2021", isFavourite = true, img = "/img/default.jpg", Category = Categories["Экономика"] }, new News { name = "Рубль упал", AuthorName = "Путин", Desc = "asfasfasfasfasfasfasfasf", date = "15.11.2021", isFavourite = true, img = "/img/default.jpg", Category = Categories["Экономика"] } ); } content.SaveChanges(); }
public ArtRepository(AppDbContent context) { this.context = context; }