public ActionResult DeleteConfirmed(int id) { CentreDeSki centreDeSki = unitOfWork.CentreDeSkiRepository.GetForSkieurByID((int)id, unitOfWork.CurrentUserID); unitOfWork.CentreDeSkiRepository.Delete(centreDeSki); unitOfWork.Save(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "CentreDeSkiID,Nom,Adresse,NbPistes,Altitude,RegionID,SkieurID")] CentreDeSki centreDeSki) { if (ModelState.IsValid) { //db.Entry(centreDeSki).State = EntityState.Modified; unitOfWork.CentreDeSkiRepository.Update(centreDeSki); unitOfWork.Save(); return(RedirectToAction("Index")); } ViewBag.RegionID = new SelectList(unitOfWork.RegionRepository.Get(), "RegionID", "NomRegion", centreDeSki.RegionID); ViewBag.SkieurID = new SelectList(unitOfWork.SkieurRepository.Get(), "SkieurID", "Nom", centreDeSki.Region.SkieurID); return(View(centreDeSki)); }
// GET: CentreDeSkis/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CentreDeSki centreDeSki = unitOfWork.CentreDeSkiRepository.GetByID((int)id); if (centreDeSki == null) { return(HttpNotFound()); } return(View(centreDeSki)); }
// GET: CentreDeSkis/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CentreDeSki centreDeSki = unitOfWork.CentreDeSkiRepository.GetForSkieurByID((int)id, unitOfWork.CurrentUserID); if (centreDeSki == null) { return(HttpNotFound()); } return(View(centreDeSki)); }
// GET: CentreDeSkis/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CentreDeSki centreDeSki = unitOfWork.CentreDeSkiRepository.GetByID((int)id); if (centreDeSki == null) { return(HttpNotFound()); } ViewBag.RegionID = new SelectList(unitOfWork.RegionRepository.Get(), "RegionID", "NomRegion", centreDeSki.RegionID); ViewBag.SkieurID = new SelectList(unitOfWork.SkieurRepository.Get(), "SkieurID", "Nom", centreDeSki.Region.SkieurID); return(View(centreDeSki)); }