예제 #1
0
        public Result <OrderViewModel> UpdateOrderStatus(int userId, long orderId, int orderStatus)
        {
            var result = new Result <OrderViewModel>();

            using (var cmd = DataCommandManager.GetDataCommand("UpdateOrderStatus"))
            {
                cmd.SetParameterValue("@UserId", userId);
                cmd.SetParameterValue("@OrderId", orderId);
                cmd.SetParameterValue("@Status", orderStatus);
                var returnValue = cmd.ExecuteNonQuery();

                result.Status = returnValue > 0 ? new Status()
                {
                    Code = "1"
                } : new Status()
                {
                    Code = "0"
                };
                var orderModel = GetOrder(orderId, userId);
                if (orderModel != null && orderModel.ProductId > 0)
                {
                    var productModel = ProductDataAccess.GetProductById(orderModel.ProductId);
                    result.Data = OrderModelToOrderViewModel(orderModel, productModel);
                }

                return(result);
            }
        }
        public IApuxActionResult GetById(GetByIdAction action)
        {
            var product = _productDataAccess.GetProductById(action.Payload);

            if (product == null)
            {
                return(new ApuxActionResult <JToken>(new InternalErrorAction()));
            }
            else
            {
                return(new ApuxActionResult <Product>(product));
            }
        }
예제 #3
0
 /// <summary>
 /// Get a product by Id
 /// </summary>
 /// <param name="id">Id</param>
 /// <returns>Product</returns>
 public Product GetProductById(int id)
 {
     return(productDataAccess.GetProductById(id));
 }
예제 #4
0
 public ProductInfo GetProductById(int id)
 {
     return(_dataAccess.GetProductById(id));
 }
 public Task <ProductItem> GetProductById(int productId)
 {
     // Perform business logic here
     return(_productDataAccess.GetProductById(productId));
 }
예제 #6
0
 public void AddProduct(int productId) => _productList.Add(_productDataAccess.GetProductById(productId));
예제 #7
0
 public ProductModel GetProductById(int productId)
 {
     return(productDataAccess.GetProductById(productId));
 }