コード例 #1
0
ファイル: EpisodesController.cs プロジェクト: sash-jozani/TOS
        public ActionResult Create(tbl_Episodes model,HttpPostedFileBase video)
        {
            try
            {
                using (TOS_DB ctx = new TOS_DB())
                {
                    tbl_Episodes episode = new tbl_Episodes();
                    episode.title = model.title;
                    episode.City = model.City;
                    episode.releaseDate = model.releaseDate;
                    episode.OtherLink = model.OtherLink;
                    episode.YouTubeLink = model.YouTubeLink;
                    episode.TosLink = model.TosLink;

                    ctx.tbl_Episodes.Add(episode);

                    if (video.ContentLength > 0)
                    {
                        var fileName = Path.GetFileName(video.FileName);
                        var path = Path.Combine(Server.MapPath("~/App_Data/Videos"), fileName);
                        video.SaveAs(path);
                        episode.videopath = video.FileName;
                    }
                    ctx.SaveChanges();

                }

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
コード例 #2
0
ファイル: SettingsController.cs プロジェクト: sash-jozani/TOS
        public ActionResult SeasonDeleteAction(int id)
        {
            TOS_DB ctx = new TOS_DB();

            var season = (from s in ctx.tbl_Seasons.Where(x => x.id == id) select s).FirstOrDefault();

            ctx.tbl_Seasons.Remove(season);
            ctx.SaveChanges();

            return RedirectToAction("Seasons");
        }
コード例 #3
0
ファイル: SettingsController.cs プロジェクト: sash-jozani/TOS
        public ActionResult SeasonEdit(tbl_Seasons model)
        {
            TOS_DB ctx = new TOS_DB();

            var season = (from s in ctx.tbl_Seasons.Where(x => x.id == model.id) select s).FirstOrDefault();

            season.number = model.number;
            season.title = model.title;
            season.startdate = model.startdate;
            season.enddate = model.enddate;

            ctx.SaveChanges();

            return RedirectToAction("Seasons");
        }
コード例 #4
0
ファイル: SettingsController.cs プロジェクト: sash-jozani/TOS
        public ActionResult SeasonCreate(tbl_Seasons model)
        {
            using (TOS_DB ctx = new TOS_DB())
            {
                tbl_Seasons season = new tbl_Seasons();
                season.number = model.number;
                season.startdate = model.startdate;
                season.title = model.title;
                season.enddate = model.enddate;

                ctx.tbl_Seasons.Add(season);
                ctx.SaveChanges();
            }

            return RedirectToAction("Seasons");
        }