public static GetProductDetailResponse Unmarshall(UnmarshallerContext context)
        {
            GetProductDetailResponse getProductDetailResponse = new GetProductDetailResponse();

            getProductDetailResponse.HttpResponse = context.HttpResponse;
            getProductDetailResponse.RequestId    = context.StringValue("GetProductDetail.RequestId");
            getProductDetailResponse.Message      = context.StringValue("GetProductDetail.Message");
            getProductDetailResponse.Code         = context.StringValue("GetProductDetail.Code");

            GetProductDetailResponse.GetProductDetail_Data data = new GetProductDetailResponse.GetProductDetail_Data();
            data.ProductId            = context.StringValue("GetProductDetail.Data.ProductId");
            data.ProductName          = context.StringValue("GetProductDetail.Data.ProductName");
            data.LendingOrganizations = context.StringValue("GetProductDetail.Data.LendingOrganizations");
            data.Terms                    = context.StringValue("GetProductDetail.Data.Terms");
            data.DailyRate                = context.StringValue("GetProductDetail.Data.DailyRate");
            data.YearRate                 = context.StringValue("GetProductDetail.Data.YearRate");
            data.FoundPartyName           = context.StringValue("GetProductDetail.Data.FoundPartyName");
            data.FoundPartyId             = context.StringValue("GetProductDetail.Data.FoundPartyId");
            data.InterestRate             = context.StringValue("GetProductDetail.Data.InterestRate");
            data.PrincipalLimit           = context.StringValue("GetProductDetail.Data.PrincipalLimit");
            data.FinancialInfo            = context.StringValue("GetProductDetail.Data.FinancialInfo");
            data.FineAmount               = context.StringValue("GetProductDetail.Data.FineAmount");
            data.Comment                  = context.StringValue("GetProductDetail.Data.Comment");
            getProductDetailResponse.Data = data;

            return(getProductDetailResponse);
        }
Esempio n. 2
0
        public async Task <ActionResult> AddProduct([FromBody] PostProductRequest productToAdd)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            else
            {
                GetProductDetailResponse response = await _productCommands.Add(productToAdd);

                return(CreatedAtRoute("products#getproductbyid", new { id = response.Id }, response));
            }
        }
Esempio n. 3
0
        public async Task <ActionResult> GetProductById(int id)
        {
            GetProductDetailResponse response = await _productLookup.GetProductById(id);

            //if (response == null)
            //{
            //    return NotFound();
            //}
            //else
            //{
            //    return Ok(response);
            //}
            return(this.Maybe(response));
        }
        /// <summary>
        /// GetProductDetailByID
        /// </summary>
        /// <param name="request">ProductDetailRequest</param>
        /// <returns>GetProductDetailResponse</returns>
        public async Task <GetProductDetailResponse> GetProductDetailByID(ProductDetailRequest request)
        {
            var response = new GetProductDetailResponse();

            try
            {
                var param = new ProductDetailByIDParameter()
                {
                    ID = request.ID
                };

                var result = _dataAccess.GetProductDetailByID(param);
                if (result != null)
                {
                    response.ProductDetail = mapper.Map <GETPRODUCTDETAIL_BY_ID_Result, ProductDetailDto>(result);
                    response.Success       = true;
                }
            }
            catch (Exception ex)
            {
                response.Success = false;
            }
            return(await Task.FromResult(response));
        }