public CategoriesViewModel() { EsaDbContext db = new EsaDbContext(); foreach (var e in db.CategoriesList) { CategoriesCollection.Add(new CategorieModel(e)); } }
public DishIngredientViewModel() { EsaDbContext db = new EsaDbContext(); foreach (var e in db.DishIngredientList) { DishIngredientModelCollection.Add(new DishIngredientModel(e)); } }
public MenuCategorieViewModel() { EsaDbContext db = new EsaDbContext(); foreach (var e in db.MenuCategorieList) { MenuCategorieCollection.Add(e); } }
public StoreViewModel() { EsaDbContext db = new EsaDbContext(); foreach (var e in db.StoreList) { StoreModelCollection.Add(new StoreModel(e)); } }
public MenuMModel(MenuModel Menu) { Id = Menu.Id; Name = Menu.Name; Datum = Menu.Datum; MenuCategoryId = Menu.MenuCategoryId; MenuCategory = new EsaDbContext().MenuCategorieList.Where(i => i.Id == MenuCategoryId).Single().Name; DatumStr = Datum.ToString("dd.MM.yyyy"); }
public IngredientViewModel() { EsaDbContext db = new EsaDbContext(); foreach (var e in db.IngredientList) { IngredientCollection.Add(e); } }
public MenuViewModel() { EsaDbContext db = new EsaDbContext(); foreach (var e in db.MenuList) { MenuMModelCollection.Add(new MenuMModel(e)); } }
public DishIngredientModel(DishIngredient DI) { Id = DI.Id; IngredientsId = DI.IngredientsId; DishId = DI.DishId; Quantity = DI.Quantity; Ingredients = new EsaDbContext().IngredientList.Where(i => i.Id == IngredientsId).Single().Name; Dish = new EsaDbContext().DishList.Where(i => i.Id == DishId).Single().Name; }
public static void Update() { DishIngredientModelCollection.Clear(); EsaDbContext db = new EsaDbContext(); foreach (var e in db.DishIngredientList) { DishIngredientModelCollection.Add(new DishIngredientModel(e)); } }
public static void Update() { MenuMModelCollection.Clear(); EsaDbContext db = new EsaDbContext(); foreach (var e in db.MenuList) { MenuMModelCollection.Add(new MenuMModel(e)); } }
public static void Update() { MenuCategorieCollection.Clear(); EsaDbContext db = new EsaDbContext(); foreach (var e in db.MenuCategorieList) { MenuCategorieCollection.Add(e); } }
public static void Update() { IngredientCollection.Clear(); EsaDbContext db = new EsaDbContext(); foreach (var e in db.IngredientList) { IngredientCollection.Add(e); } }
public static void Update() { CategoriesCollection.Clear(); EsaDbContext db = new EsaDbContext(); foreach (var e in db.CategoriesList) { CategoriesCollection.Add(new CategorieModel(e)); } }
public MenuDishModel(MenuDish menuDish) { Id = menuDish.Id; MenuId = menuDish.MenuId; DishId = menuDish.DishId; CategorieId = menuDish.CategorieId; MenuDish = menuDish; Menu = new EsaDbContext().MenuList.Where(i => i.Id == MenuId).Single().Name; Dish = new EsaDbContext().DishList.Where(i => i.Id == DishId).Single().Name; Categorie = new EsaDbContext().CategoriesList.Where(i => i.Id == CategorieId).Single().Categorie; }
public void MenuCategorieDelete(MenuCatigorie delMC) { EsaDbContext db = new EsaDbContext(); foreach (var e in db.MenuList) { if (e.MenuCategoryId == delMC.Id) { MenuDelete(e); } } db.MenuCategoriesDelete(delMC); }
public DishViewModel() { EsaDbContext db = new EsaDbContext(); foreach (var e in db.CategoriesList) { CategoriesCollection.Add(e); } foreach (var e in db.DishList) { DishModelCollection.Add(new DishModel(e)); } }
public void MenuDelete(MenuModel delMenu) { EsaDbContext db = new EsaDbContext(); foreach (var e in db.MenuDishList) { if (e.MenuId == delMenu.Id) { MenuDishDelete(e); } } db.MenuDelete(delMenu); }
public async void SaveJson() { EsaDbContext db = new EsaDbContext(); await Task.Run(() => { while (true) { using (StreamWriter file = new StreamWriter(@"C:\Users\Public\Documents\menu\Categories.json")) { var json = JsonConvert.SerializeObject(db.CategoriesList); file.Write(json); } using (StreamWriter file = new StreamWriter(@"C:\Users\Public\Documents\menu\DishIngredient.json")) { var json = JsonConvert.SerializeObject(db.DishIngredientList); file.Write(json); } using (StreamWriter file = new StreamWriter(@"C:\Users\Public\Documents\menu\Dish.json")) { var json = JsonConvert.SerializeObject(db.DishList); file.Write(json); } using (StreamWriter file = new StreamWriter(@"C:\Users\Public\Documents\menu\Ingredient.json")) { var json = JsonConvert.SerializeObject(db.IngredientList); file.Write(json); } using (StreamWriter file = new StreamWriter(@"C:\Users\Public\Documents\menu\MenuCategorie.json")) { var json = JsonConvert.SerializeObject(db.MenuCategorieList); file.Write(json); } using (StreamWriter file = new StreamWriter(@"C:\Users\Public\Documents\menu\MenuDish.json")) { var json = JsonConvert.SerializeObject(db.MenuDishList); file.Write(json); } using (StreamWriter file = new StreamWriter(@"C:\Users\Public\Documents\menu\Menu.json")) { var json = JsonConvert.SerializeObject(db.MenuList); file.Write(json); } using (StreamWriter file = new StreamWriter(@"C:\Users\Public\Documents\menu\Store.json")) { var json = JsonConvert.SerializeObject(db.StoreList); file.Write(json); } Task.Delay(2000); } }); }
public CategorieModel(Categories cat) { Id = cat.Id.ToString(); Categorie = cat.Categorie; EsaDbContext db = new EsaDbContext(); var rn = db.DishList.Where(i => i.CatigorieId == cat.Id); if (!db.DishList.Any(i => i.CatigorieId == cat.Id) && !db.MenuDishList.Any(i => i.CategorieId == cat.Id)) { Activity = true; } else { Activity = false; } }
public void CategoriesDelete(Categories delCat) { EsaDbContext db = new EsaDbContext(); foreach (var e in db.DishList) { if (e.CatigorieId == delCat.Id) { DishDelete(e); } } foreach (var e in db.MenuDishList) { if (e.CategorieId == delCat.Id) { MenuDishDelete(e); } } db.CategoriesDelete(delCat); }
public void DishDelete(Dish delDish) { EsaDbContext db = new EsaDbContext(); foreach (var e in db.DishIngredientList) { if (e.DishId == delDish.Id) { DishIngredientDelete(e); } } foreach (var e in db.MenuDishList) { if (e.CategorieId == delDish.Id) { MenuDishDelete(e); } } db.DishDelete(delDish); }
public void IngredientDelete(Ingredient delI) { EsaDbContext db = new EsaDbContext(); foreach (var e in db.DishIngredientList) { if (e.IngredientsId == delI.Id) { DishIngredientDelete(e); } } foreach (var e in db.StoreList) { if (e.IngredientsId == delI.Id) { StoreDelete(e); } } db.IngredientDelete(delI); }
public void MenuDishDelete(MenuDish delMD) //? { EsaDbContext db = new EsaDbContext(); db.MenuDishDelete(delMD); }
public void DishIngredientDelete(DishIngredient delDI) { EsaDbContext db = new EsaDbContext(); db.DishIngredientDelete(delDI); }
public void StoreDelete(Store delStore) { EsaDbContext db = new EsaDbContext(); db.StoreDelete(delStore); }