public GetApplicationsOutput GetApplicationById(GetApplicationsInput input)
        {
            var application = _applicationsManager.getApplicationById(input.Id);
            var output      = Mapper.Map <Models.Applications, GetApplicationsOutput>(application);

            return(output);
        }
Esempio n. 2
0
        public ActionResult EditApplication(int appId)

        {
            var yesOrNo = new List <string>
            {
                "True",
                "False"
            };

            var getApplicationInput = new GetApplicationsInput()
            {
                Id = appId
            };


            // get application according to givin application Id
            var application = _applicationsAppService.GetApplicationById(getApplicationInput);
            // get the list of buildings
            var buildings = _buildingsAppService.getAllBuildings();
            // get the list of building units
            var buildingUnits             = _buildingUnitsAppService.getAllBuildingUnits();
            var buildingUnitsByBuildingId = from BU in buildingUnits where BU.BuildingId == application.buildingId select BU;
            // get building information by buildingId in application
            var getBuildingInput = new GetBuidlingsInput()
            {
                Id = application.buildingId
            };
            // get the building information by BuildingId
            var building = _buildingsAppService.getBuildingsById(getBuildingInput);
            // get the information of spicific building unit
            var getBuildingUnitInput = new GetBuildingUnitsInput()
            {
                Id = application.buildingUnitId
            };
            var buildingUnit = _buildingUnitsAppService.GetBuildingUnitsById(getBuildingUnitInput);
            // get list of propertyOwnerships
            var propertyOwnerships = _propertyOwnershipAppService.getAllPropertyOwnerships();
            // get list of interventionTypes
            var interventionTypes = _interventionTypeAppService.getAllInterventionTypes();
            // get list of restorationTypes
            var restorationType = _restorationTypeAppService.getAllResorationTypes();


            var ApplicationViewModel = new ApplicationsViewModel()
            {
                applicationsOutput = application,
                Buildings          = buildings,
                BuildingUnits      = buildingUnitsByBuildingId,
                buildingOutput     = building,
                YesOrNo            = new SelectList(yesOrNo),
                PropertyOwnerShips = propertyOwnerships,
                BuildingUnit       = buildingUnit,
                InterventionTypes  = interventionTypes,
                RestorationTypes   = restorationType
            };



            return(View("_EditApplicationsModal", ApplicationViewModel));
        }