/// <summary> /// Gets all vendor reviews by vendor id /// </summary> /// <param name="pageIndex">Page index</param> /// <param name="pageSize">Page size</param> /// <param name="vendorId">Vendor Identifier</param> /// <returns>Vendor Review</returns> public virtual IList <VendorReviewList> GetVendorReviewByVendorId(int vendorId = 0) { var vendorreviews = _vendorReviewRepository.Table.Where(q => q.VendorID == vendorId); IList <VendorReviewList> query = new List <VendorReviewList>(); foreach (var vendorreview in vendorreviews) { var model = new VendorReviewList(); var vendor = _vendorService.GetVendorById(vendorId); var customer = _customerService.GetCustomerById(vendorreview.CustomerID); model.CustomerID = vendorreview.CustomerID; model.CustomerUsername = customer.Email; model.VendorID = vendorreview.VendorID; model.VendorName = vendor.Name; model.Title = vendorreview.Title; model.ReviewText = vendorreview.ReviewText; model.ReplyText = vendorreview.ReplyText; model.Rating = vendorreview.Rating; model.IsApproved = vendorreview.IsApproved; model.CreatedOnUtc = vendorreview.CreatedOnUtc; query.Add(model); } return(query); }
/// <summary> /// Gets all vendor reviews /// </summary> /// <param name="pageIndex">Page index</param> /// <param name="pageSize">Page size</param> /// <returns>Vendor Review</returns> public virtual IPagedList <VendorReviewList> GetAllVendorReview(int pageIndex = 0, int pageSize = int.MaxValue) { var vendorreviews = _vendorReviewRepository.Table; IList <VendorReviewList> query = new List <VendorReviewList>(); foreach (var vendorreview in vendorreviews) { var model = new VendorReviewList(); var vendor = _vendorService.GetVendorById(vendorreview.VendorID); var customer = _customerService.GetCustomerById(vendorreview.CustomerID); model.CustomerID = vendorreview.CustomerID; model.CustomerUsername = customer.Email; model.VendorID = vendorreview.VendorID; model.VendorName = vendor.Name; model.Title = vendorreview.Title; model.ReviewText = vendorreview.ReviewText; model.ReplyText = vendorreview.ReplyText; model.Rating = vendorreview.Rating; model.IsApproved = vendorreview.IsApproved; model.CreatedOnUtc = vendorreview.CreatedOnUtc; query.Add(model); } return(new PagedList <VendorReviewList>(query, pageIndex, pageSize)); }