Example #1
0
        public StoreOrderPrice GetPriceSync(UserOrderInput parameter)
        {
            //if (!this.IsFormValid()) {
            //    return ApiResult.Failure<StoreOrderPrice>(this.FormInvalidReason(),
            //        MessageCodes.ParameterValidationFailure);
            //}

            var result = Resolve <IOrderBuyServcie>().GetPrice(parameter);

            //if (!result.Item1.Succeeded) {
            //    if (result.Item1.Id.ToInt16() == -1) {
            //        return ApiResult.Failure<StoreOrderPrice>(result.Item1.ToString(), MessageCodes.ReremoteRequest);
            //    }

            //    return ApiResult.Failure<StoreOrderPrice>(result.Item1.ToString(), MessageCodes.ServiceFailure);
            //}

            return(result.Item2);
        }
Example #2
0
        public ApiResult <StoreOrderPrice> GetPrice([FromBody] UserOrderInput parameter)
        {
            if (!this.IsFormValid())
            {
                return(ApiResult.Failure <StoreOrderPrice>(this.FormInvalidReason(),
                                                           MessageCodes.ParameterValidationFailure));
            }

            var result = Resolve <IOrderBuyServcie>().GetPrice(parameter);

            if (!result.Item1.Succeeded)
            {
                if (result.Item1.Id.ToInt16() == -1)
                {
                    return(ApiResult.Failure <StoreOrderPrice>(result.Item1.ToString(), MessageCodes.ReremoteRequest));
                }

                return(ApiResult.Failure <StoreOrderPrice>(result.Item1.ToString(), MessageCodes.ServiceFailure));
            }

            return(ApiResult.Success(result.Item2));
        }