public async Task <IActionResult> PutPrice([FromRoute] int id, [FromBody] PriceDTO priceDTO) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != priceDTO.PriceId) { return(BadRequest()); } var price = await priceRepository.Edit(id, priceDTO); if (price == null) { return(BadRequest()); } PriceDTO dto = new PriceDTO(); dto.PriceId = price.PriceId; dto.designation = price.designation; dto.price = price.price; dto.date = price.date.ToString("yyyy-MM-dd"); return(Ok(dto)); }