コード例 #1
0
ファイル: HomeController.cs プロジェクト: talajiam/Hackathon
        public ActionResult Register(Customer cust)
        {
            if (!ModelState.IsValid)
            {
                return View();
            }

            CustomerController custReg = new CustomerController();
            if (cust.CustomerID == 0)
            {
                int customerId = custReg.Post(cust);
                cust.CustomerID = customerId;
                return RedirectToAction("LogIn");
            }
            else
            {
                List<Customer> customerList = custReg.Get().ToList();
                customerList = customerList.FindAll(a => a.EmailId == cust.EmailId);
                return RedirectToAction("Index");
            }
        }
コード例 #2
0
ファイル: HomeController.cs プロジェクト: talajiam/Hackathon
        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);
        }
コード例 #3
0
ファイル: HomeController.cs プロジェクト: talajiam/Hackathon
        public ActionResult Register()
        {
            Customer customer = new Customer();

            return View(customer);
        }