Exemplo n.º 1
0
        List <ShowOrderViewModel> GetOrderList()
        {
            var ordersList = new List <ShowOrderViewModel>();

            if (Session["ShopCart"] is List <AddShopCartViewModel> list)
            {
                foreach (var item in list)
                {
                    var product   = db.ProductsRepository.GetById(item.ProductId);
                    var showOrder = new ShowOrderViewModel
                    {
                        ProductId = item.ProductId,
                        Count     = item.Count,
                        ImageName = product.ImageName,
                        Price     = product.Price,
                        Title     = product.ProductTitle,
                        Sum       = item.Count * product.Price
                    };

                    ordersList.Add(showOrder);
                }
            }

            return(ordersList);
        }
Exemplo n.º 2
0
 public ShowOrderView(List <tblPizzaOrder> pizzas, decimal totalAmount, string JMBG)
 {
     InitializeComponent();
     DataContext = new ShowOrderViewModel(this, pizzas, totalAmount, JMBG);
 }