Ejemplo n.º 1
0
        /// <summary>
        /// this method updates the HousingComplexDto
        /// </summary>
        /// <param name="fixComplex"></param>
        /// <returns>Task<bool></returns>
        public async Task <bool> UpdateHousingComplex(HousingComplexDto fixComplex)
        {
            HousingComplex housingComplexVnM = new HousingComplex();

            //validate the incoming DTO first before converting into DAO
            //STILL NEED TO VALIDATE

            return(await graceService.UpdateHousingComplexAsync(housingComplexVnM.MapToDao(fixComplex)));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// this method inserts a new complex by calling on the soap service.
        /// The "graceService.insert" returns a bool value so we just return
        /// that since it depends on its pass or fail
        /// </summary>
        /// <param name="newComplex"></param>
        /// <returns>Task<bool></returns>
        public async Task <bool> AddHousingComplex(HousingComplexDto newComplex)
        {
            try
            {
                HousingComplex housingComplexVnM = new HousingComplex();

                //validate the incoming DTO first before converting into DAO
                //STILL NEED TO VALIDATE

                return(await graceService.InsertHousingComplexAsync(housingComplexVnM.MapToDao(newComplex)));
            }
            catch (Exception)
            {
                return(false);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// This method recieves an HousingComlexDto model that we expect to delete based off of the primary key
        /// </summary>
        /// <param name="oldComplex"></param>
        /// <returns>Task<bool></returns>
        public async Task <bool> DeleteComplex(HousingComplexDto oldComplex)
        {
            HousingComplex housingComplexVnM = new HousingComplex();

            //validate the incoming DTO first before converting into DAO
            //STILL NEED TO VALIDATE

            //first we get the currentOccupancy, if its greater then ZERO then return false
            int currOccupancy = await housingComplexVnM.returnComplexCurCap(oldComplex);

            if (currOccupancy > 0)
            {
                return(false);
            }

            else
            {
                return(await graceService.DeleteHousingComplexAsync(housingComplexVnM.MapToDao(oldComplex)));
            }
        }