Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
        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);
            }
        }
Ejemplo n.º 3
0
 public ActionResult LogIn()
 {
     LoginDetails loginDetail = new LoginDetails();
     Session["CustomerName"] = null;
     return View(loginDetail);
 }