Пример #1
0
        public async Task <IActionResult> AddShopProduct([FromForm] ShopProductInput input)
        {
            Result <string> result = await _productManager.AddShopProduct(input);

            if (result.Success)
            {
                return(Ok(result));
            }
            else
            {
                return(BadRequest(result));
            }
        }
Пример #2
0
        public async Task <Result <string> > AddShopProduct(ShopProductInput input)
        {
            Product product = new Product()
            {
                Title       = input.Title,
                Price       = input.Price,
                Description = input.Description,
                Size        = input.Size,
                ProductType = input.ProductType,
                ImageUrl    = input.ImageUrl
            };

            return(new Result <string>()
            {
                Success = true,
                Data = await _productRepository.CreateAsync(product)
            });
        }