public ActionResult DeleteConfirmed(int id) { Sejours sejours = db.Sejours.Find(id); db.Sejours.Remove(sejours); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "IdSejour,IdHotel,Duree")] Sejours sejours) { if (ModelState.IsValid) { db.Entry(sejours).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.IdHotel = new SelectList(db.Hotels, "IdHotel", "Nom", sejours.IdHotel); return(View(sejours)); }
public ActionResult CreerSejourPourHotel(int id) { ViewBag.IdHotel = new SelectList(db.Hotels, "IdHotel", "Nom"); Sejours h = new Sejours { IdHotel = id }; ViewBag.Hotel = id; return(View("Create")); }
// GET: Admin/Sejours/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Sejours sejours = db.Sejours.Find(id); if (sejours == null) { return(HttpNotFound()); } return(View(sejours)); }
// GET: Admin/Sejours/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Sejours sejours = db.Sejours.Find(id); if (sejours == null) { return(HttpNotFound()); } ViewBag.IdHotel = new SelectList(db.Hotels, "IdHotel", "Nom", sejours.IdHotel); return(View(sejours)); }
public ActionResult Create([Bind(Include = "IdSejour,IdHotel,Duree")] Sejours sejours) { var req = db.Sejours.Where(x => x.IdHotel == sejours.IdHotel && x.Duree == sejours.Duree).Any(); if (ModelState.IsValid && req == false) { db.Sejours.Add(sejours); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.IdHotel = new SelectList(db.Hotels, "IdHotel", "Nom", sejours.IdHotel); return(View(sejours)); }