Exemplo n.º 1
0
 public static HomeViewModel MapHomeToHomeViewModel(Home home)
 {
     return(new HomeViewModel
     {
         Id = home.Id,
         UserId = home.UserId,
         CityId = home.CityId,
         TotalStairCount = home.TotalStairCount,
         Stair = home.Stair,
         BuildingType = home.BuildingType,
         RoomCount = home.RoomCount,
         Area = home.Area,
         Credit = home.Credit,
         LandArea = home.LandArea,
         Address = home.Address,
         HomeTypeId = home.Id,
         HomeImg = home.HomeImg,
         Price = home.Price,
         EstateDocumentType = home.EstateDocumentType,
         AdverTypeId = home.AdverTypeId,
         AboutHome = home.AboutHome,
         SubmittedByAdmin = home.SubmittedByAdmin,
         City = CityViewModel.MapCityToCityViewModel(home.City),
         // User = UserViewModel.MapUserToUserViewModel(home.User),
         HomeType = HomeTypeViewModel.MapHomeTypeToHomeTypeViewModel(home.HomeType),
         AdverType = AdverTypeViewModel.MapAdverTypeToAdverTypeViewModel(home.AdverType)
                     //  Equipments = home.Equipments.Select(x => EquipmentOfHomeViewModel.MapEquipmentOfHomeToEquipmentOfHomeViewModel(x)).ToList()
     });
 }
Exemplo n.º 2
0
        public IActionResult AddHome()
        {
            var home = new HomeViewModel();

            home.SubmittedByAdmin = false;
            home.Cities           = homeRepo.Cities.Select(x => CityViewModel.MapCityToCityViewModel(x)).ToList();
            home.HomeTypes        = homeRepo.HomeTypes.Select(x => HomeTypeViewModel.MapHomeTypeToHomeTypeViewModel(x)).ToList();
            home.AdverTypes       = homeRepo.AdverTypes.Select(x => AdverTypeViewModel.MapAdverTypeToAdverTypeViewModel(x)).ToList();
            home.dependentUIs     = homeRepo.DependentUIs.Select(x => DependentUIViewModel.MapDependentUIToDependentUIViewModel(x)).ToList();
            home.AllEquipments    = homeRepo.Equipments.Select(x => EquipmentViewModel.MapEquipmentToEquipmentViewModel(x)).ToList();
            return(View("AddHome", home));
        }
Exemplo n.º 3
0
        public IActionResult Index()
        {
            HomesListViewModel model       = new HomesListViewModel();
            FilteringParams    filterModel = new FilteringParams();

            model.Homes            = homeRepo.GetAll().Select(x => HomeViewModel.MapHomeToHomeViewModel(x)).ToList();
            filterModel.Cities     = homeRepo.Cities.Select(x => CityViewModel.MapCityToCityViewModel(x)).ToList();
            filterModel.HomeTypes  = homeRepo.HomeTypes.Select(x => HomeTypeViewModel.MapHomeTypeToHomeTypeViewModel(x)).ToList();
            filterModel.AdverTypes = homeRepo.AdverTypes.Select(x => AdverTypeViewModel.MapAdverTypeToAdverTypeViewModel(x)).ToList();
            model.FilterParams     = filterModel;
            model.PageInfo         = new PagingInfo();
            return(View("Index", model));
        }