public ActionResult Edit([Bind(Include = "MovieName,Genre,State,Director,Duration,Release")] Movie movie) { if (ModelState.IsValid) { db.Entry(movie).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(movie)); }
public async void Test_Repository_InsertAsync() { using (var ctx = new MediaContext(Options)) { var medias = new Repository <MediaModel>(ctx); await medias.InsertAsync(_media); Assert.Equal(EntityState.Added, ctx.Entry(_media).State); } }
public ActionResult Edit([Bind(Include = "ActorId,FirstName,LastName,Born,KnownFor,PersonalDetails,MovieName")] Actor actor) { if (ModelState.IsValid) { db.Entry(actor).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.MovieName = new SelectList(db.Movies, "MovieName", "Genre", actor.MovieName); return(View(actor)); }
public void Test_Repository_Update() { using (var ctx = new MediaContext(Options)) { MediaModel temp = new MediaModel() { EntityId = 3 }; var medias = new Repository <MediaModel>(ctx); medias.Update(temp); Assert.Equal(EntityState.Modified, ctx.Entry(temp).State); } }