コード例 #1
0
 public ShoppingCartVM(int id, LoginVM userCredentials, float totalPrice, List<ShoppingCartItemDetailVM> shoppingCartItemDetailList)
 {
     Id = id;
     UserCredentials = userCredentials;
     TotalPrice = totalPrice;
     ShoppingCartItemDetailList = shoppingCartItemDetailList;
 }
コード例 #2
0
 public ActionResult Login(LoginVM loginVm)
 {
     Boolean success = UserBL.CheckCredentials(loginVm);
     if (success)
     {
         return RedirectToAction("Index", "Product");
     }
     return View();
 }
コード例 #3
0
ファイル: UserBL.cs プロジェクト: radulazariciu/Internship
        public static Boolean CheckCredentials(LoginVM userVm)
        {
            UserMapper userMapper = new UserMapper();
            List<Samsung_User> recivedList = userMapper.GetAllSamsungUsers();

            foreach (var item in recivedList)
            {
                if ((item.emailAddress.Equals(userVm.EmailAddress)) && (item.password.Equals(userVm.Password)))
                {
                    return true;
                }
            }
            return false;
        }
コード例 #4
0
        public static ShoppingCartVM GetShoppingCart()
        {
            ShoppingCartMapper shoppingCartMapper = new ShoppingCartMapper();
            ShoppingCart shoppingCart = shoppingCartMapper.GetShoppingCart();
            shoppingCart.TotalPrice = TotalPrice(shoppingCart);
            LoginVM loginVm = new LoginVM(shoppingCart.User.EmailAddress, shoppingCart.User.Password);
            List<ShoppingCartItemVM> shoppingCartItemVmList = new List<ShoppingCartItemVM>();
            foreach (var shoppingCartItem in shoppingCart.ShoppingCartItemsList)
            {
               var shoppingCartItemVM=new ShoppingCartItemVM(shoppingCartItem.IdProduct, shoppingCartItem.Quantity);
                shoppingCartItemVmList.Add(shoppingCartItemVM);
            }

            ShoppingCartVM shoppingCartVM = new ShoppingCartVM(shoppingCart.Id, loginVm, shoppingCart.TotalPrice,shoppingCartItemVmList);

            return shoppingCartVM;
        }