public string addWish(int productId) { //kullanıcı login olmuşsa if (User.Identity.IsAuthenticated) { int customerId = customerManager.GetAll().FirstOrDefault(x => x.email == User.Identity.Name).customerId; WishList newWish = new WishList() { customerId = customerId, productId = productId }; // eğer wishList içerisinde aynı adam aynı ürünü daha önce beğenmişse if (!wishListManager.GetAll().Exists(x => x.productId == productId && x.customerId == customerId)) { wishListManager.Save(newWish); } return("Beğenildi"); } return("Beğeni yapmak için üye olunuz"); }
public ActionResult Wishlist() { var customerId = repoUser.GetAll().Where(u => u.email == User.Identity.Name).FirstOrDefault().userId; return(View(repoWishList.GetAll().Where(x => x.userId == customerId))); }
public IEnumerable <WishList> Get() { return(wishListRepository.GetAll()); }