public IActionResult CreateOrder([FromBody] OrderForCreationDto orderInfo) { var orderError = "Please ensure your data is correct!"; Order order = new Order(); if (orderInfo == null) { return(BadRequest(orderError)); } order.CustomerId = orderInfo.CustomerId; order.DriverId = orderInfo.DriverId; order.RestaurantId = orderInfo.RestaurantId; order.TotalCost = orderInfo.Cost; if (order.TotalCost < 0) { return(StatusCode(500, "Cost can't be less than 0!")); } order.CreatedAtDate = DateTime.Now; order.UpdatedAtDate = order.CreatedAtDate; _orderInfoRepository.AddOrder(order); if (!_orderInfoRepository.Save()) { return(StatusCode(500, "Something went wrong...")); } return(Ok(order)); }