public ActionResult Create1(int id, int storeid, int localid, Orderedpizzas ordpizz) { storeid = storeidy; id = idy; localid = localidy; try { DateTime newtime = DateTime.Now; PizzaWebApp.Models.Orderdetails neworder = new PizzaWebApp.Models.Orderdetails() { Customerid = id, Storeid = storeid, Locationid = localid, Dateplaced = newtime, Totalcost = ordpizz.Pizzascost, }; Repo.Createorder(neworder); PizzaWebApp.Models.Orderdetails order = Repo.Getorderbytime(newtime); ordpizz.Orderid = order.Orderid; Repo.Createpizzaorder(ordpizz); return(RedirectToAction(nameof(Index))); } catch { return(View()); } }
public static Data.Orderdetails TimeorderMap(Mods.Orderdetails order) => new Data.Orderdetails { Orderid = order.Orderid, Customerid = order.Customerid, Storeid = order.Storeid, Locationid = order.Locationid, Totalcost = order.Totalcost, Dateplaced = order.Dateplaced, };
public static Data.Orderdetails CustomdetsMap(Mods.Orderdetails dets) => new Data.Orderdetails { Orderid = dets.Orderid, Customerid = dets.Customerid, Storeid = dets.Storeid, Locationid = dets.Locationid, Totalcost = dets.Totalcost, Dateplaced = dets.Dateplaced, };
public static Data.Orderdetails Map(PizzaWebApp.Models.Orderdetails orderdetails) => new Data.Orderdetails { Orderid = orderdetails.Orderid, Customerid = orderdetails.Customerid, Storeid = orderdetails.Storeid, Locationid = orderdetails.Locationid, Totalcost = orderdetails.Totalcost, Dateplaced = orderdetails.Dateplaced, Customer = CustomMap(orderdetails.Customer), Location = Map(orderdetails.Location), Store = Map(orderdetails.Store), History = Map(orderdetails.History).ToList(), Ordereddrinks = Map(orderdetails.Ordereddrinks).ToList(), Orderedpizzas = Map(orderdetails.Orderedpizzas).ToList(), Orderedsides = Map(orderdetails.Orderedsides).ToList(), };
public void Createorder(Mods.Orderdetails order) { _db.Add(CreateMap(order)); Save(); }