public ActionResult SeasonEdit(int id) { TOS_DB ctx = new TOS_DB(); var season = (from s in ctx.tbl_Seasons.Where(x=>x.id == id) select s).FirstOrDefault(); return View(season); }
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(); } }
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"); }
// // GET: /Admin/Home/ public ActionResult Index() { DashboardModel model = new DashboardModel(); TOS_DB ctx = new TOS_DB(); model.EpisodesCount = ctx.tbl_Episodes.Count(); model.RequestsCount = ctx.tbl_requests.Count(); model.GuidesCount = ctx.tbl_Guides.Count(); return View(model); }
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"); }
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"); }
// // GET: /Admin/Settings/ public ActionResult Seasons() { TOS_DB ctx = new TOS_DB(); var seasons = (from s in ctx.tbl_Seasons select s).ToList(); SeasonsModel model = new SeasonsModel(); model.Seasons = seasons; return View(model); }
// // GET: /Admin/Episodes/ public ActionResult Index() { TOS_DB ctx = new TOS_DB(); var episodes = (from e in ctx.tbl_Episodes select e).ToList(); return View(episodes); }