Пример #1
0
        public ActionResult AddEpisode(TBLEpisode p)
        {
            var series = db.TBLSeries.Where(c => c.s_id == p.TBLSeries.s_id).FirstOrDefault();

            p.TBLSeries = series;
            db.TBLEpisode.Add(p);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #2
0
        public ActionResult UpdateEpisode(TBLEpisode p)
        {
            var episode = db.TBLEpisode.Find(p.e_id);

            episode.e_name     = p.e_name;
            episode.e_duration = p.e_duration;
            var series = db.TBLSeries.Where(c => c.s_id == p.TBLSeries.s_id).FirstOrDefault();

            episode.e_seasonID  = series.s_id;
            episode.e_info      = p.e_info;
            episode.e_seasonNo  = p.e_seasonNo;
            episode.e_episodeNo = p.e_episodeNo;
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }