Exemple #1
0
        public List <Models.HouseModel> GetAll()
        {
            try
            {
                List <Models.HouseModel> houseModels   = new List <Models.HouseModel>();
                HouseManager             houseManager  = new HouseManager();
                List <HouseEntity>       houseEntities = houseManager.GetAll();

                foreach (HouseEntity houseEntity in houseEntities)
                {
                    Models.HouseModel houseModel = new Models.HouseModel();
                    houseModel.ID          = houseEntity.ID;
                    houseModel.RegionID    = houseEntity.RegionID;
                    houseModel.SubCityID   = houseEntity.SubCityID;
                    houseModel.WoredaID    = houseEntity.WoredaID;
                    houseModel.SiteName    = houseEntity.SiteName;
                    houseModel.BlockNumber = houseEntity.BlockNumber;
                    houseModel.FloorNumber = houseEntity.FloorNumber;
                    houseModel.GovernmentTransferedDate = houseEntity.GovernmentTransferedDate;
                    houseModel.HouseNumber = houseEntity.HouseNumber;

                    houseModel.RegionModel       = new Models.RegionModel();
                    houseModel.RegionModel.ID    = houseEntity.RegionEntity.ID;
                    houseModel.RegionModel.TItle = houseEntity.RegionEntity.TItle;

                    houseModel.SubCityModel       = new Models.SubCityModel();
                    houseModel.SubCityModel.ID    = houseEntity.SubCityEntity.ID;
                    houseModel.SubCityModel.TItle = houseEntity.SubCityEntity.TItle;

                    houseModel.WoredaModel       = new Models.WoredaModel();
                    houseModel.WoredaModel.ID    = houseEntity.WoredaEntity.ID;
                    houseModel.WoredaModel.TItle = houseEntity.WoredaEntity.TItle;

                    houseModels.Add(houseModel);
                }

                return(houseModels);
            }
            catch (Exception)
            {
                return(null);
            }
        }