public IActionResult Update(int id, ProductUpdateVM updateVM)
        {
            var product = _query.GetById(id);

            updateVM.ProductImage = product.ProductImage;
            updateVM.ProductName  = product.ProductName;
            updateVM.ProductPrice = product.ProductPrice;
            updateVM.ProductSku   = product.ProductSku;
            updateVM.ProductSlug  = product.ProductSlug;
            updateVM.CategoryId   = product.CategoryId;
            updateVM.Categories   = _categoryService.List();
            return(View(updateVM));
        }
        public IHttpActionResult Get(Guid id)
        {
            var result = _productQueryService.GetById(id);

            result.Price *= 10;
            return(Ok(result));
        }
Exemple #3
0
        /// <summary>
        /// دریافت یک محصول
        /// </summary>
        /// <param name="productId"></param>
        /// <returns></returns>
        public IHttpActionResult Get(Guid productId)
        {
            var dto = new MobileResultDto
            {
                Result = _productQueryService.GetById(productId)
            };

            return(Ok(dto));
        }
        public IActionResult Update(int id, OrderUpdateVM updateVM)
        {
            var order = _query.GetById(id);

            updateVM.Id              = order.Id;
            updateVM.ProductId       = order.ProductId;
            updateVM.CustomerId      = order.CustomerId;
            updateVM.ProductName     = __productService.GetById(order.ProductId).ProductName;
            updateVM.CustomerName    = _customerService.GetById(order.CustomerId).UserName;
            updateVM.BillingAddress  = order.BillingAddress;
            updateVM.ShippingAddress = order.ShippingAddress;
            updateVM.PaymentMethod   = order.PaymentMethod;
            updateVM.OrderStatus     = order.OrderStatus;

            return(View(updateVM));
        }