public IActionResult Details(int id) { if (id < 1) { return(BadRequest("Id cannot be 0")); } Verbinding verbinding = repo.GetVerbindingbyId(id); if (verbinding == null) { return(BadRequest("Verbinding could not be found")); } VerbindingDetailViewModel vm = converter.VerbindingToViewModel(verbinding); return(View(vm)); }
public void GetVerbindingbyId() { EmptyLists(); verbindingRepository = new VerbindingRepository(context); Verbinding verbinding = new Verbinding(1, "naam", 50, new Perron(1, "naam", true), new Perron(2, "naam", true), true); Verbinding verbinding2 = verbindingRepository.GetVerbindingbyId(1); Assert.Equal(verbinding.Id, verbinding2.Id); Assert.Equal(verbinding.Naam, verbinding2.Naam); Assert.Equal(verbinding.Lengte, verbinding2.Lengte); }