public void SetUserSession(FoodmanduDbUserViewModel model)
 {
     var user = this.context.FoodmanduDbUsers.Where(x => x.UserName == model.UserName).FirstOrDefault();
     UserSession.UserId = user.UserId;
     UserSession.UserName = user.UserName;
     UserSession.DisplayName = user.UserName;
 }
        public ActionResult Login(FoodmanduDbUserViewModel model)
        {
            LoginServices loginService = new LoginServices();


            if (loginService.CheckUser(model))
            {
                loginService.SetUserSession(model);
                return RedirectToAction("Index", "Orders");
            }

            ViewBag.ErrorMessage = "Invalid Username Or Password";
            return View("Login");
        }
 public bool CheckUser(FoodmanduDbUserViewModel model)
 {
     var user = this.context.FoodmanduDbUsers.Where(x => x.UserName == model.UserName).FirstOrDefault();
     if(user!=null)
     {
         if(model.Password==user.Password)
         {
             return true;
         }
         return false;
     }
     else
     {
         return false;
     }
 }