Example #1
0
        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);
        }
Example #2
0
        public ActionResult Products(List<ProductItem> productItemVal)
        {
            if (TempData["myObject"] != null)
            {
                productItemVal = (List<ProductItem>)TempData["myObject"];
            }

            if (Session["userId"] == null)
            {
                return RedirectToAction("LogIn");
            }

            ViewBag.Title = "Products";
            ViewBag.Message = "Your Products page.";
            var teantid = FAAS.App_Start.Helper.GetTeantId();
            // var products = FAAS.App_Start.Helper.GetProducts(teantid);
            ProductController proCon = new ProductController();
            var products = proCon.Get();
            if (productItemVal != null)
            {
                products.Where(x => x.ProductId == productItemVal.First().ProductId).ToList().ForEach(a => a.Qty = productItemVal.First().Qty);

            }
            //  products.ToList().FindAll.ForEach(a => a.Qty == productItemVal.First().Qty);

            FAAS.Models.HeaderModel model = new Models.HeaderModel();
            model.TenantImageUrl = FAAS.App_Start.Helper.GetCustomLogo(teantid);
            model.productItems = products.ToList();
            if (Session["userId"] != null)
            {
                var uid = Session["userId"];
                model.CustmorID = (int)uid;
            }

            return View(model);
        }