public ActionResult Index(LoginDetails loninDetail) { if (loninDetail.CustomerEmail == null) { return RedirectToAction("LogIn"); } CustomerController custReg = new CustomerController(); List<Customer> customerList = custReg.Get().ToList(); ViewBag.Message = "Food as a Service"; ViewBag.Message = "Your Products page."; var teantid = FAAS.App_Start.Helper.GetTeantId(); //ServiceController con = new ServiceController(); // IEnumerable<string> pro =con.Get(); ProductController proCon = new ProductController(); var products = proCon.Get(); // var products = FAAS.App_Start.Helper.GetProducts(teantid); FAAS.Models.HeaderModel model = new Models.HeaderModel(); model.TenantImageUrl = FAAS.App_Start.Helper.GetCustomLogo(teantid); model.productItems = products.ToList().FindAll(a => a.ProductId == 100); if (customerList.Count > 0) { var customer = customerList.Find(a => a.EmailId == loninDetail.CustomerEmail); model.CustmorID = customer.CustomerID; Session["userId"] = model.CustmorID; Session["CustomerName"] = loninDetail.CustomerName; Session["Image"] = customer.ImageUrl; } return View(model); }
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); }
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"); } }
public ActionResult LogIn(LoginDetails loninDetail) { CustomerController custReg = new CustomerController(); if (!ModelState.IsValid) { return View(); } else { List<Customer> customerList = custReg.Get().ToList(); customerList = customerList.FindAll(a => a.EmailId == loninDetail.CustomerEmail && a.Password == loninDetail.Password1); if (customerList.Count > 0) { loninDetail.CustomerID = customerList[0].CustomerID; loninDetail.CustomerEmail = customerList[0].EmailId; loninDetail.CustomerName = customerList[0].CustomerName; } else { loninDetail.Password1 = ""; loninDetail.CustomerEmail = ""; loninDetail.CustomerName = ""; return View(loninDetail); } return RedirectToAction("Index", loninDetail); } }