public ActionResult ModifierRestaurant(int id, Restaurant poRestau) { if (ModelState.IsValid) { dal.ModifierRestaurant(poRestau.Id, poRestau.Nom, poRestau.Adresse, poRestau.Telephone, poRestau.Email); return RedirectToAction("AfficherRestaurant", new { id = poRestau.Id }); } return View(); }
public int CreerRestaurant(string nom, string adresse, string telephone, string email) { Restaurant restaurant = new Restaurant() { Nom=nom, Adresse=adresse, Telephone=telephone, Email=email }; sctx.Restaurants.Add(restaurant); sctx.SaveChanges(); return restaurant.Id; }
public ActionResult CreerRestaurant(Restaurant poResto) { if (dal.RestaurantExist(poResto.Nom)) { ModelState.AddModelError(string.Empty, "Ce restaurant existe déja"); } if (ModelState.IsValid) { dal.CreerRestaurant(poResto.Nom, poResto.Adresse, poResto.Telephone, poResto.Email); return RedirectToAction("index"); } else { return View(); } }