Example #1
0
        public IActionResult NewCheese(string Name, string Description)
        {
            Models.Cheese newCheese = new Models.Cheese();
            newCheese.Name        = Name;
            newCheese.Description = Description;
            Cheeses.Add(newCheese.Name, newCheese.Description);

            return(Redirect("/Cheese"));
        }
Example #2
0
 public IActionResult Add(AddCheeseViewModel addCheeseViewModel)
 {
     if (ModelState.IsValid)
     {
         //Add the new cheese
         Cheese newCheese = new Models.Cheese
         {
             Name        = addCheeseViewModel.Name,
             Description = addCheeseViewModel.Description,
             Type        = addCheeseViewModel.Type
         };
         CheeseData.Add(newCheese);
         return(Redirect("/Cheese"));
     }
     return(View(addCheeseViewModel));
 }