public ActionResult GetBuildingDetails(int buildingId) { var viewModel = new BuildingListViewModel() { Items = new List <ResidenceViewModel>(), Building = new BuildingViewModel() }; viewModel.Building.id_budynku = buildingId; var result = residencesService.GetResidencesById(buildingId); result.ForEach(u => viewModel.Items.Add(ViewModelMapper.Mapper.Map <ResidenceViewModel>(u))); var buildingResult = residencesService.GetSingleBuilding(buildingId); viewModel.Building.adres_budynku = buildingResult.adres_budynku; ViewBag.Errors = TempData["Errors"]; return(View("BuildingDetails", viewModel)); }
public void ConfirmFaultEdit(int faultId, string buildingAddress, int residenceNumber, string description, string state) { var building = residencesService.GetSingleBuilding(buildingAddress); var residenceId = residencesService.GetSingleResidenceByNumber(building.id_budynku, residenceNumber).id_mieszkania; var newRental = new FaultViewModel() { id_usterki = faultId, id_mieszkania = residenceId, opis = description, stan = state }; faultService.AddOrEditFault(ViewModelMapper.Mapper.Map <FaultModel>(newRental)); }
public void ConfirmRentalEdit(int rentalId, string residentPESEL, string buildingAddress, int residenceNumber, DateTime?startDate, DateTime?expiringDate, float?rentalPrice) { var residentId = residentService.GetSingleResident(residentPESEL).id_najemcy; var building = residencesService.GetSingleBuilding(buildingAddress); var residenceId = residencesService.GetSingleResidenceByNumber(building.id_budynku, residenceNumber).id_mieszkania; var newRental = new StrictRentalDataViewModel() { cena_miesieczna = rentalPrice, data_rozpoczecia = startDate, data_zakonczenia = expiringDate, id_mieszkania = residenceId, id_najemcy = residentId, id_wynajmu = rentalId }; rentalService.AddOrEditRental(ViewModelMapper.Mapper.Map <StrictRentalDataModel>(newRental)); }