示例#1
0
        public IActionResult Details(int id)
        {
            if (id < 1)
            {
                return(BadRequest("Id cannot be 0"));
            }

            Wagon wagon = repo.GetWagonbyId(id);

            if (wagon == null)
            {
                return(BadRequest("Wagon could not be found"));
            }

            WagonDetailViewModel vm = converter.WagonToViewModel(wagon);

            return(View(vm));
        }
示例#2
0
        public void GetWagonbyId()
        {
            EmptyLists();

            wagonRepository = new WagonRepository(context);
            Wagon wagon = new Wagon(1, "naam", 13, 25);

            Assert.Equal(wagon.Id, wagonRepository.GetWagonbyId(1).Id);
            Assert.Equal(13, wagon.Stoelaantal_Klasse1);
        }