public ActionResult ModifierRestaurant(Resto resto)
 {
     if (!ModelState.IsValid)
     {
         return View(resto);
     }
     using (IDal dal = new Dal())
     {
         dal.ModifierRestaurant(resto.Id, resto.Nom, resto.Telephone);
         return RedirectToAction("Index");
     }
 }
Exemple #2
0
        public void ModifierRestaurant_CreerPuisModifier()
        {
            IDal dal;
            using (dal = new Dal())
            {
                dal.CreerRestaurant("Chez mamie", "04 75 46 22 14");
                List<Resto> restos = dal.ObtientTousLesRestaurants();
                int id = restos.First(r => r.Nom == "Chez mamie").Id;

                dal.ModifierRestaurant(id, "Chez Mamie", null);

                restos = dal.ObtientTousLesRestaurants();
                Assert.IsNotNull(restos);
                Assert.AreEqual(1, restos.Count);
                Assert.AreEqual("Chez Mamie", restos[0].Nom);
                Assert.IsNull(restos[0].Telephone);
            }
        }