Ejemplo n.º 1
0
        public async Task <IActionResult> GetChildrenAndExtraBedPolicyListingByHotelId([FromBody] int hotelId)
        {
            if (hotelId != default(int) && hotelId > default(int))
            {
                BaseResult <List <ChildrenAndExtraBedPolicies> > childrenAndExtraBedPoliciesResult = await iPolicies.GetChildrenAndExtraBedPolicyListingByHotelId(hotelId).ConfigureAwait(false);

                if (childrenAndExtraBedPoliciesResult.IsError && childrenAndExtraBedPoliciesResult.ExceptionMessage != null)
                {
                    return(new StatusCodeResult(500));
                }
                else if (childrenAndExtraBedPoliciesResult.Result == null || childrenAndExtraBedPoliciesResult.Result.Count == 0)
                {
                    return(NoContent()); //204
                }
                else
                {
                    var result = PoliciesResponseMapper.MapChildrenAndExtraBedPolicyList(childrenAndExtraBedPoliciesResult);
                    return(Ok(result)); //200
                }
            }
            return(BadRequest());//400
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> GetChildrenAndExtraBedPolicy([FromBody] int hotelId)
        {
            if (hotelId != default(int) && hotelId > default(int))
            {
                BaseResult <List <ChildrenAndExtraBedPolicies> > childrenAndExtraBedPoliciesResult = await iPolicies.GetChildrenAndExtraBedPolicyListingByHotelId(hotelId).ConfigureAwait(false);

                if (childrenAndExtraBedPoliciesResult.IsError && childrenAndExtraBedPoliciesResult.ExceptionMessage != null)
                {
                    return(new StatusCodeResult(500));
                }

                BaseResult <List <MaxChildAndExtraBedPerRoom> > MaxChildAndExtraBedPerRoomResult = await iPolicies.GetMaxChildAndExtraBedPerRoom(hotelId).ConfigureAwait(false);

                if (MaxChildAndExtraBedPerRoomResult.IsError && MaxChildAndExtraBedPerRoomResult.ExceptionMessage != null)
                {
                    return(new StatusCodeResult(500));
                }

                var result = PoliciesResponseMapper.MapChildrenAndExtraBedPolicyToAddOrUpdate(childrenAndExtraBedPoliciesResult, MaxChildAndExtraBedPerRoomResult);
                return(Ok(result)); //200
            }
            return(BadRequest());   //400
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> GetActiveCancellationPolicy([FromBody] int hotelId)
        {
            BaseResult <List <CancellationPolicyViewModel> > response = new BaseResult <List <CancellationPolicyViewModel> >();

            if (hotelId <= default(int))
            {
                response.IsError = true;
                response.Message = Core.Model.Helper.Constants.ErrorMessage.InvalidId;
                return(this.BadRequest(response));
            }
            var result = await this.iPolicies.GetActiveCancellationPolicies(hotelId);

            if (result.IsError && result.ExceptionMessage != null)
            {
                return(StatusCode(500, response));
            }
            else if (result.Result == null || !result.Result.Any())
            {
                return(this.NoContent()); // 204
            }
            response = PoliciesResponseMapper.MapCancellationPolicy(result);
            return(this.Ok(response)); // 200
        }