public async Task SeedAsync(ApplicationDbContext dbContext, IServiceProvider serviceProvider) { if (dbContext.Categories.Any()) { return; } var categoriesAndProductsData = CategoriesData.GetCategories(); await dbContext.Categories.AddRangeAsync(categoriesAndProductsData); }
public ProductsCategoryViewModel(INavigation navigation) { _categoriesData = new CategoriesData(); CategoriesCollection = _categoriesData.GetCategories(); _navigation = navigation; }
//Get Categories public JsonResult GetCategories( ) { return(Json(CategoryData.GetCategories(), JsonRequestBehavior.AllowGet)); }