public ActionResult <ObjectResult> AcceptEstimate([FromBody] AcceptEstimateDTO acceptEstimateDTO) { try { OrderService orderService = new OrderService(Startup.BeePlaceDataBaseConnectionString); var estimate = orderService.GetOrderEstimate(new OrderEstimate() { Id = acceptEstimateDTO.IdOrderEstimate }); if (!estimate.Accepted) { Order order = new Order(); order.OrderEstimate.Accepted = acceptEstimateDTO.Accepted; order.OrderEstimate.Justify = acceptEstimateDTO.Justify; order.OrderEstimate.IdCompanyPartner = acceptEstimateDTO.IdCompanyPartner; orderService.AcceptEstimate(order); return(StatusCode((int)HttpStatusCode.OK, order)); } else { return(StatusCode((int)HttpStatusCode.BadRequest)); } } catch (Exception e) { return(StatusCode((int)HttpStatusCode.InternalServerError, e.Message)); } }