public void Update(T item, Func <T, bool> findByIDPredecate)
        {
            var local = Context.Set <T>()
                        .Local
                        .FirstOrDefault(findByIDPredecate);

            if (local != null)
            {
                Context.Entry(local).State = EntityState.Detached;
            }
            Context.Entry(item).State = EntityState.Modified;
        }
Ejemplo n.º 2
0
 public ActionResult Edit(int id, Event e)
 {
     try
     {
         // TODO: Add update logic here
         using (EventManagerEntities dbModel = new EventManagerEntities())
         {
             dbModel.Entry(e).State = EntityState.Modified;
             dbModel.SaveChanges();
         }
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }