public static List <string> FindListHoaDon(string idFood) { QUANLYQUANANEntities entity = new QUANLYQUANANEntities(); try { var result = (from ct in entity.CHITIETHOADONs where ct.MAMONAN == idFood group new { ct } by new { ct.MAHD } into grp select grp.Key.MAHD ); return(result.ToList()); } catch (Exception) { entity.Dispose(); return(null); } }
public static List <MonAnViewModel> LoadMonAn() { QUANLYQUANANEntities entities = new QUANLYQUANANEntities(); try { var res = (from m in entities.MONANs select new MonAnViewModel() { Ma = m.MAMONAN, Anh = m.HINHANH, Ten = m.TENMONAN, }).ToList(); return(res); } catch (Exception) { entities.Dispose(); return(null); } }