コード例 #1
0
        public void UpdateRestaurant()
        {
            var ctxt = new RestaurantContext();
            var srv  = new RestaurantsServices(ctxt);

            var idrestoav = srv.getAll().Last().ID;
            var resto     = srv.getRestobyid(idrestoav);

            Assert.AreEqual("mon resto", resto.Nom);
            resto.Nom = "mon resto 2";
            srv.update(resto);
            var idrestoap = srv.getAll().Last().ID;
            var restoap   = srv.getRestobyid(idrestoap);

            Assert.AreEqual("mon resto 2", restoap.Nom);
        }
コード例 #2
0
        public void UpdateNote()
        {
            var ctxt = new RestaurantContext();
            var srv  = new RestaurantsServices(ctxt);

            var idrestoav = srv.getAll().Last().ID;
            var resto     = srv.getRestobyid(idrestoav);

            Assert.AreEqual("13", resto.note.note);
            resto.note.note = "20";
            srv.update(resto);
            var idrestoap = srv.getAll().Last().ID;

            resto = srv.getRestobyid(idrestoap);

            Assert.AreEqual("20", resto.note.note);
        }
コード例 #3
0
        public void DeleteRestaurant()
        {
            var ctxt      = new RestaurantContext();
            var srv       = new RestaurantsServices(ctxt);
            var nbrestoav = srv.getAll().Count();
            var idresto   = srv.getAll().Last().ID;
            var resto     = srv.getRestobyid(idresto);

            srv.deleteRestaurant(resto.ID);
            var nbrestoap = srv.getAll().Count();

            Assert.AreEqual(nbrestoav - 1, nbrestoap);
        }
コード例 #4
0
        public IActionResult Details(int id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Restaurant resto = _restaurantsService.getRestobyid(id);

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

            return(View(resto));
        }