コード例 #1
0
 public IActionResult Index(string email, string password)
 {
     try
     {
         Online_Selling_SIte.Models.User user = _loginRepo.UserLogin(email, password);
         if (user != null)
         {
             HttpContext.Session.SetString("UserName", user.Name);
             HttpContext.Session.SetString("UserId", user.Id.ToString());
             int cartcount = _cartRepo.GetTotalCartCount();
             HttpContext.Session.SetInt32("TotalCart", cartcount);
             return(RedirectToAction("Index", "UserDashboard"));
         }
         else
         {
             ViewBag.invalid = "Invalid Email & Password.!";
         }
     }
     catch (Exception)
     {
         throw;
     }
     return(View());
 }