Esempio n. 1
0
        public async Task <IActionResult> Post([FromBody] PriceRequest request)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            try
            {
                var price = await _priceService.CalculateSalePrice(request.Ids);

                return(Ok(new PriceResponse {
                    IsSuccess = true, Price = price
                }));
            }
            catch (Exception ex)
            {
                return(Ok(new PriceResponse {
                    IsSuccess = false, ErrorMessage = ex.Message
                }));
            }
        }