public IActionResult PostAddNewRoutes([FromBody] IEnumerable <Route> Rotes) { bool success = _routesAppService.AddRoutes(Rotes); if (success) { return(Ok()); } else { return(Problem("failed to add route", null, 500)); } }
public void Test_AddRoutes() { List <Route> novasRotas = new List <Route>() { new Route() { Origin = "GRU", Destination = "BRC", Value = 10 }, new Route() { Origin = "BRC", Destination = "SCL", Value = 5 }, new Route() { Origin = "GRU", Destination = "CDG", Value = 75 }, new Route() { Origin = "GRU", Destination = "SCL", Value = 20 }, new Route() { Origin = "GRU", Destination = "ORL", Value = 56 }, new Route() { Origin = "ORL", Destination = "CDG", Value = 5 }, new Route() { Origin = "SCL", Destination = "ORL", Value = 20 }, }; var retorno = _routesAppService.AddRoutes(novasRotas); Assert.IsTrue(retorno); }