public ActionResult InsertInWishList() { if (Session[KeyList.SessionKeys.UserID] == null) { return(RedirectToAction("Index", "Register_Login")); } if (RouteData.Values["id"] != null) { int DealID = Convert.ToInt32(RouteData.Values["id"].ToString()); WishList InsWishList = new WishList(); InsWishList.DealId = DealID; InsWishList.UserId = Convert.ToInt32(Session[KeyList.SessionKeys.UserID].ToString()); InsWishList.AddedOn = System.DateTime.Now; wishListService = new UserWishListService(new DealsDB()); if (wishListService.wishlistCheck(DealID, InsWishList.UserId) == true) { wishListService.Insert(InsWishList); ViewBag.Message = "Added to WishList"; } else { ViewBag.Message = "Already Added"; } wishListService.Dispose(); return(RedirectToAction("Index", "Home")); } return(RedirectToAction("Index", "Home")); }
public ActionResult ViewWishList() { if (Session[KeyList.SessionKeys.UserID] == null) { return(RedirectToAction("Index", "Register_Login")); } wishListService = new UserWishListService(new DealsDB()); var List = wishListService.ViewWishListByUser(Convert.ToInt32(Session[KeyList.SessionKeys.UserID])); wishListService.Dispose(); return(View(List)); }
public ActionResult RemoveFromWishList() { if (Session[KeyList.SessionKeys.UserID] == null) { return(RedirectToAction("Index", "Register_Login")); } if (RouteData.Values["id"] != null) { int DealID = Convert.ToInt32(RouteData.Values["id"].ToString()); int UserID = Convert.ToInt32(Session[KeyList.SessionKeys.UserID].ToString()); wishListService = new UserWishListService(new DealsDB()); WishList DelWishList = wishListService.GetAll().Where(x => x.DealId == DealID && x.UserId == UserID).FirstOrDefault(); wishListService.Delete(DelWishList); wishListService.Dispose(); return(View("ViewWishList")); } else { return(View("ViewWishList")); } }