예제 #1
0
 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));
 }
예제 #2
0
        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);
            }
        }
예제 #3
0
 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));
 }
예제 #4
0
 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);
     }
 }