public RecipeService() { rp = new RecipeRepo(); irp = new IngredientRepo(); mrp = new MemberRepo(); orp = new OthersRepo(); }
public RecipeCreateSelectViewModel GetAll() { var ingRepo = new IngredientRepo(); var othRepo = new OthersRepo(); return(new RecipeCreateSelectViewModel(ingRepo.GetAll(), othRepo.GetAllMeasurements(), othRepo.GetAllBeerTypes())); }
public ActionResult CreateRecipe(int?recipeID) { CreateRecipeVM recipeVM = new CreateRecipeVM(); if (recipeID != null && recipeID != 0) { var r = rr.GetRecipeByID((int)recipeID); recipeVM.RecipeName = r.RecipeName; recipeVM.PrepTime = r.PrepTime; recipeVM.CookTime = r.CookTime; recipeVM.TotalTime = r.TotalTime; recipeVM.RecipeCategoryID = r.RecipeCategoryID; recipeVM.RecipeIngredients = r.RecipeIngredients.ToList(); recipeVM.RecipeSteps = r.RecipeSteps.ToList(); } IngredientRepo ingredientRepo = new IngredientRepo(); var ingredientCategories = ingredientRepo.GetIngredientCategories(); var listRecipeCategories = rr.GetAllRecipeCategoriesSelect(); var listMeasueTypes = rr.GetAllMeasurmentTypes(); recipeVM.RecipeCategories = listRecipeCategories; recipeVM.MeasurmentTypes = listMeasueTypes; recipeVM.IngredientCategories = ingredientCategories; return(View(recipeVM)); }
public ActionResult ViewIngredients(int category) { IngredientsVM ic = new IngredientsVM(); IngredientRepo ri = new IngredientRepo(); ic.IngredientCategories = ri.GetIngredientCategories(); ic.Ingrdients = ri.GetIngredientsByCategory(category); return(View(ic)); }
public ActionResult CreateIngredient() { CreateIngredientVM ci = new CreateIngredientVM(); IngredientRepo ingredientRepo = new IngredientRepo(); var listOfCategories = ingredientRepo.GetAllIngredientCategories(); ci.IngredientCategories = listOfCategories; return(View(ci)); }
public int GetByName(string ingredient) { var ingRepo = new IngredientRepo(); var ing = ingRepo.GetByName(ingredient); if (ing == null) { return(-1); } return(ing.IngredientId); }
public int CheckAndCreateIngredient(string IngredientName) { var ingRep = new IngredientRepo(); var drivenI = ingRep.GetByName(IngredientName); if (drivenI == null) { return(ingRep.CreateByName(IngredientName)); } return(drivenI.IngredientId); }
public ActionResult GetIngredientsByCategory(int category) { IngredientsVM i = new IngredientsVM(); IngredientRepo ir = new IngredientRepo(); var ingredients = ir.GetIngredientsByCategory(category); i.Ingrdients = ingredients; return(PartialView("IngredientList", i)); }
private void SetRepo() { _ingredientRepo = new IngredientRepo(_context); _tableRepo = new TableRepo(_context); _reservationRepo = new ReservationRepo(_context); _categoryRepo = new CategoryRepo(_context); _salesRepo = new SaleRepo(_context); _occupancyRepo = new OccupanciesRepo(_context); _recipeRepo = new RecipeRepo(_context); _productRepo = new ProductRepo(_context); _supplierRepo = new SupplierRepo(_context); _subCategoryRepo = new SubCategoryRepo(_context); _logRepo = new LogRepo(_context); }
public ActionResult ViewIngredient(int IngredientID) { try { CreateIngredientVM vm = new CreateIngredientVM(); IngredientRepo ri = new IngredientRepo(); var ingredient = ri.GetIngredientByID(IngredientID); vm.IngredientName = ingredient.IngredientName; vm.IngredientCategory = ingredient.IngredientCategory.IngredientCategory1; return(View(vm)); } catch (Exception ex) { throw; } }
public ActionResult CreateIngredient(CreateIngredientVM model) { if (!ModelState.IsValid) { return(View(model)); } try { IngredientRepo ri = new IngredientRepo(); Ingredient i = new Ingredient(); i.IngredientName = model.IngredientName; i.IngredientCategoryID = model.IngredientCategoryID; i = ri.InsertIngredient(i); ModelState.Clear(); return(RedirectToAction("ViewIngredient", new { i.IngredientID })); } catch (Exception ex) { throw; } }
public void TestInit() { repo = new IngredientRepo(); }
public IngredientViewModel GetRecipeIngredientById(int recipeId, int ingredientId) { var ingRepo = new IngredientRepo(); return(ingRepo.GetRecipeIngredientById(recipeId, ingredientId)); }
public Controller() { recepiesRepo = new RecepiesRepo(); ingredientRepo = new IngredientRepo(); opskriftRepo = new OpskriftRepo(ingredientRepo); }
public MemberService() { mrp = new MemberRepo(); irp = new IngredientRepo(); }
private Controller() { ingredientRepo = new IngredientRepo(); bookRepo = new CookbookRepo(); }