public async Task <IActionResult> DeletePrice([FromRoute] int id) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var price = await priceRepository.Remove(id); 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)); }