public static MonThanhPham DocTheoId(int iD) { var khoSanPhamLogic = new MonThanhPhamLogic(); MonThanhPhamBDO khoSP_BDO = null; MonThanhPham khoSP_DTO = null; try { khoSP_BDO = khoSanPhamLogic.DocTheoId(iD); if (khoSP_BDO != null) { khoSP_DTO = new MonThanhPham(); //Chuyển đổi MonThanhPham.ChuyenBDOThanhDTO(khoSP_BDO, khoSP_DTO); } } catch { } return(khoSP_DTO); }
public static List <MonThanhPham> DocTatCa() { //Sắp xếp theo thứ tự var khoSanPhamLogic = new MonThanhPhamLogic(); List <MonThanhPham> nguon = null; try { nguon = khoSanPhamLogic.DocTatCa().Select(x => new MonThanhPham { ID = x.ID, Ten = x.Ten, Ma_01 = x.Ma_01, Ma_02 = x.Ma_02, Ma_03 = x.Ma_03, DaySoLuong = x.DaySoLuong, DonViTinh = x.DonViTinh, ThuTu = (int)x.ThuTu }).OrderBy(x => x.ThuTu).ToList(); } catch { } return(nguon); }