Exemplo n.º 1
0
 public static Library.Models.UserOrder Map(Entities.UserOrder userOrder)
 {
     return(new Library.Models.UserOrder
     {
         Id = userOrder.Id,
         StoreId = userOrder.StoreId,
         UserId = userOrder.UserId,
         OrderContent = userOrder.OrderContent,
         TotalCost = userOrder.TotalCost,
         OrderDateTime = userOrder.OrderDateTime
     });
 }
Exemplo n.º 2
0
        public ActionResult Index(FAAS.Models.HeaderModel model)
        {
            if (!ModelState.IsValid)
            {
                return View(model);
            }

            int ItemsCount = 0;
            double TotalBill = 0;
            Entities.UserOrder Order = new Entities.UserOrder();
            Entities.Checkout chekout = new Entities.Checkout();
            CheckoutModel chekoutmodel = new CheckoutModel();
            List<ProductItem> proList = new List<ProductItem>();
            try
            {
                foreach (var prodct in model.productItems)
                {
                    if (prodct.IsSelected || prodct.Qty > 0)
                    {
                        ProductItem confirmedProduct = new ProductItem();
                        ItemsCount++;
                        TotalBill += prodct.Price * prodct.Qty;
                        confirmedProduct.ProductId = prodct.ProductId;
                        confirmedProduct.Qty = prodct.Qty;
                        confirmedProduct.Price = prodct.Price;
                        confirmedProduct.Name = prodct.Name;
                        confirmedProduct.Calories = prodct.Calories;
                        confirmedProduct.ImageUrl = prodct.ImageUrl;
                        proList.Add(confirmedProduct);
                    }
                }

                chekoutmodel.TotalPrice = TotalBill;
                chekoutmodel.TotalItemQty = ItemsCount;
                chekoutmodel.ProdcutItems = proList;

                // Get Customer Address Detail Based on CustID

                CustomerController custReg = new CustomerController();
                List<Customer> customerList = custReg.Get(model.CustmorID).ToList(); chekoutmodel.CustmorID = model.CustmorID;
                if (customerList.Count > 0)
                {
                    chekoutmodel.CustomerName = customerList[0].CustomerName; //address.CustomerName;
                    chekoutmodel.DeliveryLocationCode = customerList[0].Postcode; //address.Postcode;
                    chekoutmodel.DeliveryAddress = customerList[0].Address;//address.Address;
                    chekoutmodel.MobileNo = customerList[0].MobileNo.ToString(); //address.MobileNo;

                }
                else
                {
                    Customer address = new Customer();
                    chekoutmodel.CustomerName = "Uday"; //address.CustomerName;
                    chekoutmodel.DeliveryLocationCode = "AL74FG"; //address.Postcode;
                    chekoutmodel.DeliveryAddress = "House No 10 ,Heartford";//address.Address;
                    chekoutmodel.MobileNo = "9739027030"; //address.MobileNo;
                }
                chekoutmodel.DeliveryCharge = 5;
                chekoutmodel.DeliveryStartDate = DateTime.Today.AddHours(12);
                chekoutmodel.DeliveryEndDate = DateTime.Today.AddHours(13);
            }

            catch (Exception ex)
            {
            }
            chekout.ItemQty = ItemsCount;
            chekout.TotalPrice = TotalBill;

            return View("Payment", chekoutmodel);
        }
Exemplo n.º 3
0
 public void AddOrder(Library.Models.UserOrder order)
 {
     Entities.UserOrder _order = Mapper.Map(order);
     _dbContext.Add(_order);
 }