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"); }