public OrderResponse AddOrder(Order order, DateTime date) { OrderResponse response = new OrderResponse(); TaxResponse taxResponse = new TaxResponse(); ProductResponse productRepsone = new ProductResponse(); productRepsone.product = productRepo.FindByProductType(order.ProductType); taxResponse.tax = taxRepo.FindByState(order.State); if (date < DateTime.Today) { response.Success = false; response.Message = "Cannot add to past days."; return(response); } if (string.IsNullOrWhiteSpace(order.CustomerName) || order.Area < 100 || taxResponse.tax == null || productRepsone.product == null) { response.Success = false; response.Message = "Missing some required fields or invalid inputs."; return(response); } order = CalculateOrder(order); order.OrderNumber = repo.AddOrder(order, date.ToString("MMddyyyy")).OrderNumber; response.Success = true; response.order = order; return(response); }