public ActionResult Edit([Bind(Include = "EpisodeID,Season,Episodes,Title,Date_Aired,Plot,Review,Complete")] Episode episode) { if (ModelState.IsValid) { db.Entry(episode).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(episode)); }
public ActionResult Edit([Bind(Include = "EpisodeId,Title,Synopsis,OrigionalAirDate,Duration")] Episode episode) { if (ModelState.IsValid) { db.Entry(episode).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(episode)); }
public void UpdateEpisodeIfLastUpdatedIsNewer(Episode ep) { Episode epFromDB = _context.Episodes .FirstOrDefault(b => b.TVDBEpisodeId == ep.TVDBEpisodeId); if (epFromDB != null // comment out next 2 lines if LastUpdated bug on thetvdb API is still around && (epFromDB.LastUpdated < ep.LastUpdated) ) { Log.Information("LastUpdated property newer on Episode {a}: {b} ", epFromDB.Id, ep.EpisodeName); ep.Id = epFromDB.Id; _context.Entry(epFromDB).CurrentValues.SetValues(ep); _context.SaveChanges(); Log.Information("Updated entry for {a}: {b}", epFromDB.Id, ep.EpisodeName); } }