コード例 #1
0
 // The nice way!
 public static PizzaDelivery BigPizzaProcess3(PizzaRecipe recipe)
 {
     return(recipe
            .Order("big")
            .Prepare()
            .Cook(180)
            .Deliver());
 }
コード例 #2
0
        // The ol'good way.
        public static PizzaDelivery BigPizzaProcess1(PizzaRecipe recipe)
        {
            var order     = OrderPizza(recipe, "big");
            var coldPizza = PreparePizza(order);
            var hotPizza  = CookPizza(coldPizza, 180);
            var delivery  = DeliverPizza(hotPizza);

            return(delivery);
        }
コード例 #3
0
ファイル: frmPizzas.cs プロジェクト: Zemba99/Pizzapaltas_DB
        private async void btnUpdate_Click(object sender, EventArgs e)
        {
            using (IRepository repo = RepositoryFactory.Create())
            {
                PizzaRecipe p  = new PizzaRecipe();
                int         id = (int)lstPizzas.SelectedItems[0].Tag;

                try
                {
                    var pizzaUpdate = await repo.EditPizza(new PizzaRecipe { ID = id, Name = txtName.Text, Price = float.Parse(txtPrice.Text) });

                    MessageBox.Show("Updated Successfully");
                }
                catch (Exception ex)
                {
                    MessageBox.Show("You Need To Fill The Boxes To Update");
                }
                FillLstPizzas();
                CancelPizza();
                ClearPizza();
            }
        }
コード例 #4
0
ファイル: Repository.cs プロジェクト: Zemba99/Pizzapaltas_DB
 public async Task <PizzaRecipe> EditPizza(PizzaRecipe pizza)
 {
     return((await Connection.QueryAsync <PizzaRecipe>("EditPizzas", new { ID = pizza.ID, Name = pizza.Name, Price = pizza.Price }, commandType: CommandType.StoredProcedure)).FirstOrDefault());
 }
コード例 #5
0
ファイル: Repository.cs プロジェクト: Zemba99/Pizzapaltas_DB
 public async Task <PizzaRecipe> DeletePizza(PizzaRecipe pizza)
 {
     return((await Connection.QueryAsync <PizzaRecipe>("DeletePizzasV2", new { Name = pizza.Name, Price = pizza.Price }, commandType: CommandType.StoredProcedure)).First());
 }
コード例 #6
0
ファイル: Repository.cs プロジェクト: Zemba99/Pizzapaltas_DB
 public async Task <PizzaRecipe> AddNewPizzaContent(PizzaRecipe pizza)
 {
     return((await Connection.QueryAsync <PizzaRecipe>("AddNewPizzaContent", new { Ingredients_id = pizza.Ingredient_id, Pizza_id = pizza.Pizza_id }, commandType: CommandType.StoredProcedure)).First());
 }
コード例 #7
0
 public static PizzaOrder Order(this PizzaRecipe recipe, string size)
 {
     return(PizzaService.OrderPizza(recipe, size));
 }
コード例 #8
0
 // The Arabic way: You read from right to left.
 public static PizzaDelivery BigPizzaProcess2(PizzaRecipe recipe)
 {
     return(DeliverPizza(CookPizza(PreparePizza(OrderPizza(recipe, "big")), 180)));
 }
コード例 #9
0
 public static PizzaOrder OrderPizza(PizzaRecipe recipe, string size)
 {
     return(new PizzaOrder());
 }