public TopReviewModels BaiNhanXet2BaiNhanXetViewModels(BaiNhanXet topReview) { AccountBus acBus = new AccountBus(); ReviewFilmsBus bus = new ReviewFilmsBus(); ThanhVien temp = acBus.getMemberByUserId(topReview.MS_TaiKhoan); TopReviewModels result = new TopReviewModels(); result.UserName = temp.HoTen; result.postDate = (DateTime) topReview.NgayDang; result.content = topReview.NoiDung; result.totalRank = bus.getTotalRank(topReview.MaSo); result.title = topReview.TieuDe; result.MS_Phim = (int) topReview.MS_Phim; result.MS_ReView = (int) topReview.MaSo; FilmBus filmBus = new FilmBus(); Phim p = filmBus.getFilmByID(result.MS_Phim.ToString()); result.ulr_HinhAnh = p.HinhAnh; result.TenPhim = p.TenPhim; return result; }
private List<TopReviewModels> BaiNhanXet2TopReviewModel(List<BaiNhanXet> lstBaiNhanXet) { List<TopReviewModels> result = new List<TopReviewModels>(); AccountBus acBus = new AccountBus(); foreach (BaiNhanXet baiNhanXet in lstBaiNhanXet) { TopReviewModels temp = new TopReviewModels(); temp.MS_Phim = (int) baiNhanXet.MS_Phim; temp.MS_ReView = baiNhanXet.MaSo; temp.MS_TaiKhoan = baiNhanXet.MS_TaiKhoan; ThanhVien thanhVien = acBus.getMemberByUserId(temp.MS_TaiKhoan); temp.UserName = thanhVien.HoTen; temp.postDate = (DateTime) baiNhanXet.NgayDang; temp.TenPhim = baiNhanXet.Phim.TenPhim; temp.title = baiNhanXet.TieuDe; temp.content = baiNhanXet.NoiDung; temp.ulr_HinhAnh = baiNhanXet.Phim.HinhAnh; result.Add(temp); } return result; }