예제 #1
0
 public void Update(TEntity parameter)
 {
     using (var context = new HSERPEntities(_connectString))
     {
         try
         {
             context.Set <TEntity>().Attach(parameter);
             context.Entry(parameter).State = EntityState.Modified;
             context.SaveChanges();
         }
         catch (Exception e)
         {
             Debug.WriteLine(e.Message);
         }
     }
 }
        public void Update(List <TEntity> parameters)
        {
            using (var context = new HSERPEntities(_connectString))
            {
                try
                {
                    foreach (var info in parameters)
                    {
                        context.Set <TEntity>().Attach(info);
                        context.Entry(info).State = EntityState.Modified;
                    }

                    context.SaveChanges();
                }
                catch (Exception e)
                {
                    Debug.WriteLine(e.Message);
                }
            }
        }