Example #1
0
        public IActionResult RecipeList()
        {
            RecipePotionViewModel rpvm = new RecipePotionViewModel();

            rpvm.Recipes = repo.Recipes;
            return(View(rpvm));
        }
Example #2
0
 public Tests()
 {
     frepo = new FakeRepository();
     home  = new HomeController(frepo);
     i1    = new Ingredient {
         IngID = 0, IngPicture = "nether.png", IngName = "NetherWart", IngDescription = "The basics of every potion.", IngStock = 250
     };
     i2 = new Ingredient {
         IngID = 1, IngPicture = "sugar.png", IngName = "Sugar", IngDescription = "Sweet.", IngStock = 50
     };
     i3 = new Ingredient {
         IngID = 2, IngPicture = "blaze.png", IngName = "Blaze Powder", IngDescription = "Hot to the touch.", IngStock = 50
     };
     p1 = new Potion {
         PotionID = 0, PotionName = "Potion of Swiftness", PotionDescription = "Makes the user run with godspeed", PIng1 = i1, PIng2 = i2, PIng3 = i2, PotionStock = 1
     };
     p2 = new Potion {
         PotionID = 1, PotionName = "Potion of Strength", PotionDescription = "Gives the strength of the mightiest warrior", PIng1 = i1, PIng2 = i3, PIng3 = i3, PotionStock = 1
     };
     p3 = new Potion {
         PotionID = 2, PotionName = "Potion of Coolness", PotionDescription = "Makes you really cool", PIng1 = i1, PIng2 = i2, PIng3 = i3, PotionStock = 1
     };
     r1 = new Recipe {
         RecipeID = 0, RPotionName = "Potion of Swiftness", RPotionDesc = "Makes the user run with godspeed", RIng1 = i1, RIng2 = i2, RIng3 = i2
     };
     r2 = new Recipe {
         RecipeID = 1, RPotionName = "Potion of Strength", RPotionDesc = "Gives the strength of the mightiest warrior", RIng1 = i1, RIng2 = i3, RIng3 = i3
     };
     r3 = new Recipe {
         RecipeID = 2, RPotionName = "Potion of Coolness", RPotionDesc = "Makes you really cool", RIng1 = i1, RIng2 = i2, RIng3 = i3
     };
     frepo.Potions.Clear();
     frepo.Recipes.Clear();
     frepo.Ingredients.Clear();
     frepo.Ingredients.Add(i1);
     frepo.Ingredients.Add(i2);
     frepo.Ingredients.Add(i3);
     pcvm = new PotionCreationViewModel {
         Ingredients = frepo.Ingredients, Recipes = frepo.Recipes
     };
     prcvm = new PotionRecipeCreationViewModel {
         Recipes = frepo.Recipes, Ingredients = frepo.Ingredients
     };
     psvm = new PotionStockViewModel {
         Ingredients = frepo.Ingredients, Potions = frepo.Potions
     };
     rpvm = new RecipePotionViewModel {
         Recipes = frepo.Recipes
     };
     msvn = new MerchantShopViewModel {
         IngList = frepo.Ingredients
     };
 }
Example #3
0
 public IActionResult RecipeDelete(RecipePotionViewModel rpvm)
 {
     repo.deleteRecipe(repo.getRecipeByID(rpvm.RecipeID));
     rpvm.Recipes = repo.Recipes;
     return(View("RecipeList", rpvm));
 }