public async Task<IActionResult> Create([FromForm] ProductCreateRequest request)
        {
            var productId = await _manageProductService.Create(request);
            if (productId == 0)
                return BadRequest();

            var product = await _manageProductService.GetById(productId, request.LanguageId);

            return CreatedAtAction(nameof(GetById), new { id = productId }, product);
        }
        public async Task <IActionResult> create([FromForm] ProductCreateRequest request)
        {
            var productId = await _manageProductService.Create(request);

            if (productId == 0)
            {
                return(BadRequest());
            }
            var product = await _manageProductService.getProductById(productId);

            return(CreatedAtAction(nameof(getProductById), new { id = productId }, product));
        }
Esempio n. 3
0
        public async Task <IActionResult> Create([FromForm] ProductCreateRequest request)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var productId = await _manageProductService.Create(request);

            if (productId == 0)
            {
                return(BadRequest());
            }
            var product = await _manageProductService.GetById(productId, request.LanguageId);

            return(CreatedAtAction(nameof(GetById), new { id = productId }, product));
        }