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); }
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); }
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); }
public IActionResult Details(int id) { if (id == null) { return(NotFound()); } Restaurant resto = _restaurantsService.getRestobyid(id); if (resto == null) { return(NotFound()); } return(View(resto)); }