public async Task <IActionResult> Delete(int id) { try { var order = await _unitOfWork.OrderRepository.GetObjectAsync(id); if (order == null) { return(ActionResultHelper.CreateFailedResult($"Order {id} not found")); } _unitOfWork.OrderRepository.RemoveObject(order); await _unitOfWork.Context.SaveChangesAsync(); return(ActionResultHelper.CreateSucceededResult()); } catch (Exception e) { _logger.LogError(e, "api/Orders/{id} DELETE technical error"); return(ActionResultHelper.CreateFailedResult("Sorry there was a technical error. Try to retry the request or contact technical support.")); } }