コード例 #1
0
        //Edit
        #region
        // GET: films/Edit/5
        public ActionResult Edit(int?id)
        {
            if (Request.IsAjaxRequest())
            {
                try
                {
                    ManagerFilm manager = new ManagerFilm();
                    film        film    = manager.GetFilm(id);

                    ViewBag.id_type = new SelectList(new ManagerTypeFilm().GetType_film(), "id", "typage");
                    ViewBag.id_film = new SelectList(new ManagerFilm().GetAllFilms(), "id", "titre");

                    ManagerFilm m = new ManagerFilm();
                    film        f = m.GetFilm(id);
                    if (f != null)
                    {
                        return(PartialView("PartialEdit", f));
                    }
                }
                catch (Exception e)
                {
                    TempData.Add("Alert", e.Message);
                }
            }
            return(RedirectToAction("Index"));
        }
コード例 #2
0
 //Delete
 #region
 // GET: films/Delete/5
 public ActionResult Delete(int?id)
 {
     try
     {
         ManagerFilm m = new ManagerFilm();
         film        f = m.GetFilm(id);
         if (f != null)
         {
             return(PartialView("PartialDelete", f));
         }
     }
     catch (Exception e)
     {
         TempData.Add("Alert", e.Message);
     }
     return(RedirectToAction("Index"));
 }
コード例 #3
0
 // GET: films/Details/5
 public ActionResult Details(int?id)
 {
     try
     {
         ManagerFilm m = new ManagerFilm();
         film        f = m.GetFilm(id);
         if (f != null)
         {
             return(PartialView("PartialDetails", f));
         }
         else
         {
             throw new NullIdExecption("film");
         }
     }
     catch (Exception e)
     {
         TempData.Add("Alert", e.Message);
         return(RedirectToAction("Index"));
     }
 }