예제 #1
0
        public void Update(T item, Func <T, bool> findByIDPredecate)
        {
            var local = Context.Set <T>()
                        .Local
                        .FirstOrDefault(findByIDPredecate); // (f => f.ID == item.ID);

            if (local != null)
            {
                Context.Entry(local).State = EntityState.Detached;
            }

            Context.Entry(item).State = EntityState.Modified;

            //Context.Entry(category).State = EntityState.Modified;
            //var entry = Context.Entry(category);
            //Context.Categories.Attach(category);
            //entry.State = EntityState.Modified;
            //Context.SaveChanges();
        }
예제 #2
0
 public void UpdateMovie(Movie movie)
 {
     _context.Entry(movie).State = EntityState.Modified;
 }