예제 #1
0
        public List <ReviewDisplayModel> GetAllForAdmin()
        {
            List <Review> reviews = FindAll();

            var reviewDisplay = new List <ReviewDisplayModel>();

            foreach (Review r in reviews)
            {
                ReviewDisplayModel rdm = DisplayModelFromReview(r);
                rdm.ProductName = DaoManager.ProductDao.FindById(r.ProductId).Name;
                reviewDisplay.Add(rdm);
            }

            return(reviewDisplay);
        }
예제 #2
0
        public List <ReviewDisplayModel> GetAllForProduct(int productId, int userId = -1)
        {
            List <Review> reviews = Find("ProductId", productId.ToString());

            var reviewDisplay = new List <ReviewDisplayModel>();

            foreach (Review r in reviews)
            {
                ReviewDisplayModel rdm = DisplayModelFromReview(r);
                rdm.CanEdit = (r.UserId == userId);
                reviewDisplay.Add(rdm);
            }

            return(reviewDisplay);
        }