public PhongCustomerController(ApplicationDbContext db, IWebHostEnvironment iwebHostEnvironment) { _db = db; _iwebhostenvironment = iwebHostEnvironment; PhongVM = new PhongViewModel() { loaiphongs = _db.LoaiPhongs.ToList(), //chuongtrinhs = _db.ChuongTrinhs.ToList(), phongs = new Data.DataModel.Phong() }; }
public async Task <PhongViewModel> GetById(string id) { var phong = await _context.Phongs.FindAsync(id); if (phong == null) { throw new QuanLySinhVien_Exceptions($"Không thể tìm thấy: {id}"); } var phongViewModel = new PhongViewModel() { ID = phong.ID, SoThuTu = phong.SoThuTu, TenCoSo = phong.TenCoSo, }; return(phongViewModel); }