private void ItemPanel_Load(object sender, EventArgs e) { FoodDBContext dbContext = new FoodDBContext(); var qeury = from item in dbContext.FoodItems orderby item.ItemName ascending select item.ItemName; string[] ItemArray = qeury.ToArray(); cmbItemList.Items.AddRange(ItemArray); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddCors(Options => { Options.AddPolicy("VueCorsPolicy", build => { build.AllowAnyHeader() .AllowAnyMethod() .AllowCredentials() .WithOrigins("http://localhost:8080"); }); }); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); var connStr = Configuration.GetConnectionString("FoodDatabase"); var foodDbContext = new FoodDBContext(connStr); services.AddSingleton(foodDbContext); }
public FoodCategoryController(FoodDBContext dbContext) { _dbContext = dbContext; }
public FoodInfoController(FoodDBContext dbContext) { _dbContext = dbContext; }
public BusinessHelper() { dbContext = new FoodDBContext(); }