public static CommuneViewModel getCommune(int idCommune) { CommuneDAO pDAO = CommuneDAO.getCommune(idCommune); int idDep = pDAO.idDepartementCommuneDAO; DepartementViewModel m = DepartementORM.getDepartement(idDep); CommuneViewModel p = new CommuneViewModel(pDAO.idCommuneDAO, pDAO.nomCommuneDAO, pDAO.codePostalDAO, m); return(p); }
public static ObservableCollection <CommuneViewModel> listeCommune() { ObservableCollection <CommuneDAO> lDAO = CommuneDAO.listeCommune(); ObservableCollection <CommuneViewModel> l = new ObservableCollection <CommuneViewModel>(); foreach (CommuneDAO element in lDAO) { int idDep = element.idDepartementCommuneDAO; DepartementViewModel m = DepartementORM.getDepartement(idDep); CommuneViewModel p = new CommuneViewModel(element.idCommuneDAO, element.nomCommuneDAO, element.codePostalDAO, m); l.Add(p); } return(l); }