public IActionResult Details(int id) { Madbestillings madbestillings = madbestillingRepository.Get(id); MadmenuBestillingVM vm = ViewModelCreator.createMadmenuBestillingVM(madmenuRepository); vm.Madbestillings = madbestillings; return(View(vm)); }
public void AddNewMadbestillingToDatabase() { IMadbestillingRepository testRepo = DataTestService.GetInMemoryRepo(); var madbestillings = new Madbestillings() { MenuTekst = "Burger", AntalBestillinger = 1 }; testRepo.Save(madbestillings); Assert.Single(testRepo.Get()); Assert.Equal(madbestillings.MenuTekst, testRepo.Get(1).MenuTekst); }
public void DeleteMadbestillingFromDatabase() { IMadbestillingRepository testrepo = DataTestService.GetInMemoryRepo(); var madbestillings = new Madbestillings() { MenuTekst = "Burger", AntalBestillinger = 1 }; testrepo.Save(madbestillings); testrepo.Delete(testrepo.Get(1).MadbestillingId); Assert.Empty(testrepo.Get()); }
public void MadbestillingWithSameIDOverWritesCurrentMadbestillingInDB() { IMadbestillingRepository testrepo = DataTestService.GetInMemoryRepo(); var madbestillings = new Madbestillings() { MenuTekst = "Burger", AntalBestillinger = 1 }; testrepo.Save(madbestillings); var sameMadbestilling = testrepo.Get(1); sameMadbestilling.MenuTekst = "Burger2"; testrepo.Save(sameMadbestilling); Assert.Single(testrepo.Get()); Assert.Equal(sameMadbestilling.MenuTekst, testrepo.Get(1).MenuTekst); }