public ShoppingCartVM(int id, LoginVM userCredentials, float totalPrice, List<ShoppingCartItemDetailVM> shoppingCartItemDetailList) { Id = id; UserCredentials = userCredentials; TotalPrice = totalPrice; ShoppingCartItemDetailList = shoppingCartItemDetailList; }
public ActionResult Login(LoginVM loginVm) { Boolean success = UserBL.CheckCredentials(loginVm); if (success) { return RedirectToAction("Index", "Product"); } return View(); }
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; }
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; }