public ActionResult Details(int id) { if (Session["LoginID"] != null) { List <OrderProduct> orderProductList = new List <OrderProduct>(); ProductHistory producthis = productHistory.GetByProductNameCategory(product.Get(id).Product_name, product.Get(id).CategoryID); int pid = producthis.Product_id; orderProductList = OrderProduct.GetByCustomerId((int)Session["LoginID"], pid); if (orderProductList.Count == 0) { Session["notbuy"] = "In order to review you need to Buy this product"; } else { Session["notbuy"] = null; } } return(View(product.Get(id))); }