コード例 #1
0
 public IActionResult Create([Bind("Id,Name,Description,Price")] Pizza pizza)
 {
     if (ModelState.IsValid)
     {
         _context.CreatePizza(pizza);
         return(RedirectToAction(nameof(Index)));
     }
     return(View(pizza));
 }
コード例 #2
0
 public IActionResult Create(Pizza pizza)
 {
     if (ModelState.IsValid)
     {
         _ps.CreatePizza(pizza);
         return(RedirectToAction(nameof(Index)));
     }
     return(View(pizza));
 }
コード例 #3
0
 public void DeepCreate(Order order)
 {
     Create(order);
     order.GetPizzas().ToList().ForEach(pizza => {
         pizza.SetOrder(order);
         PizzaService.CreatePizza(pizza);
     });
     order.GetBeverages().ToList().ForEach(beverage => {
         beverage.SetOrder(order);
         BeverageService.CreateBeverage(beverage);
     });
 }
コード例 #4
0
ファイル: Menu.cs プロジェクト: Constante-ou-Mort/PizzaStore
        public void MakeOrder()
        {
            Console.WriteLine($"Choose any pizza: (1){PizzaType.California} (8$) , (2){PizzaType.Detroit}(10$), (3){PizzaType.Neapolitan}(12$)");
            var pizzaType = Console.ReadLine();

            var pizza = _pizzaService.ChoosePizza(pizzaType);

            _pizzaService.PayForPizza(_user);
            var createdPizza = _pizzaService.CreatePizza(pizza);

            Console.WriteLine($"{_user.Name}, please, take your {createdPizza.Name} pizza.");
        }
コード例 #5
0
 public ActionResult CreatePizza(Pizza newPizza)
 {
     if (ModelState.IsValid)
     {
         _pizzaService.CreatePizza(newPizza);
         return(RedirectToAction("Index", "Home"));
     }
     else
     {
         return(View(newPizza));
     }
     //return View();
 }
コード例 #6
0
 public RedirectToActionResult Create([Bind("Id,Name,Description,Price,Size")] Pizza pizza)
 {
     _context.CreatePizza(pizza);
     return(RedirectToAction(nameof(Index)));
 }
コード例 #7
0
 public Pizza Create(Pizza pizza)
 {
     return(PizzaService.CreatePizza(pizza));
 }