public void CreateOrder(TempCustomerOrder1 Order) { PCO.TempCustomerOrder.Add(MapTempCustomerOrder.Map(Order)); PCO.SaveChanges(); }
public void UpdateOrder(TempCustomerOrder1 Order) { throw new NotImplementedException(); }
public IActionResult CreateNewPizza(TempCustomerOrder tmp, bool Sauce, bool Sausage, bool Pepperoni, bool Cheese, bool Pineapple, int Size, int Crust, int number) { if (Size > 100) { return(View()); } //int size = tmp.Size; //string crust = tmp.Crust; //bool sauce = tmp.sauce; //bool cheese = tmp.cheese; //bool pepperoni = tmp.pepperoni; //bool sausage = tmp.sausage; for (int i = 0; i < number; i++) { char[] tops = new char[5]; if (Sauce) { tops[0] = '1'; } else { tops[0] = '0'; } if (Cheese) { tops[1] = '1'; } else { tops[1] = '0'; } if (Pepperoni) { tops[2] = '1'; } else { tops[2] = '0'; } if (Sausage) { tops[3] = '1'; } else { tops[3] = '0'; } if (Pineapple) { tops[4] = '1'; } else { tops[4] = '0'; } // add pizza cypher to format code into database model PizzaOrderCypher POC = new PizzaOrderCypher(); POC.setCrust(Crust); POC.setSize(Size); POC.setToppings(tops); POC.getPriceOfPizza(); // Add Full Order to POC current Customer order. ViewBag.id = tmp.PizzaId + 1; FullOrder.storeID = CustomerInfo.StoreId; FullOrder.UserID = CustomerInfo.Id; FullOrder.currOrder.Add(POC); TempCustomerOrder1 TCO = new TempCustomerOrder1(); TCO.Toppings = BitFlagConversion.convertFlagArrayToInt(tops); TCO.Size = POC.size; TCO.Crust = POC.crust; TCO.CustId = CustomerInfo.Id; TCO.StoreId = CustomerInfo.StoreId; TCO.PizzaId = new Random().Next(10000000, 100000000); TCO.Price = POC.price; _repo_tmp.CreateOrder(TCO); } return(View()); }