Example #1
0
        public async Task <IActionResult> GetCountOfFacilitiesAndAmenitiesForSelectedContract([FromBody] int contractId)
        {
            var result = new BaseResult <HotelFacilityRoomAmenity>();

            if (contractId <= default(int))
            {
                result.IsError = true;
                result.Message = Constants.BadRequestErrorMessage.InvalidTemplateId;
                return(BadRequest(result));
            }
            var facilityCount = await contracts.GetCountOfFacilitiesForSelectedContract(contractId, base.LanguageId);

            var amenityCount = await contracts.GetCountOfAmenitiesForSelectedContract(contractId, base.LanguageId);

            if (facilityCount.IsError && facilityCount.ExceptionMessage != null || amenityCount.IsError && amenityCount.ExceptionMessage != null)
            {
                return(StatusCode(500, result));
            }
            result.Result = ContractsResponseMapper.MapCountOfHotelFacilityRoomAmenity(facilityCount.Result, amenityCount.Result);
            return(Ok(result));
        }