public IActionResult Details(int id)
        {
            Madbestillings      madbestillings = madbestillingRepository.Get(id);
            MadmenuBestillingVM vm             = ViewModelCreator.createMadmenuBestillingVM(madmenuRepository);

            vm.Madbestillings = madbestillings;

            return(View(vm));
        }
Ejemplo n.º 2
0
        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);
        }
        // GET: Madbestillings/Edit/5
        public IActionResult Edit(int id)
        {
            Madbestillings madbestillings = madbestillingRepository.Get(id);

            if (madbestillings == null)
            {
                return(NotFound());
            }

            MadmenuBestillingVM vm = ViewModelCreator.createMadmenuBestillingVM(madmenuRepository);

            vm.Madbestillings = madbestillings;

            return(View(vm));
            // Create an edit view
            // Look up cat object from catId in the database
            // Show an edit view to the user, displaying the cat object
        }
Ejemplo n.º 4
0
        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());
        }
Ejemplo n.º 5
0
        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);
        }