Beispiel #1
0
 public static bool InsertEntityAbo07 <T>(T entity, ABO07Entities pContext) where T : class
 {
     try
     {
         if (pContext.Entry(entity).State == EntityState.Detached)
         {
             pContext.Set <T>().Add(entity);
         }
         return(true);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Beispiel #2
0
        public static bool UpdateEntity <T>(T pEntity, ABO07Entities pContext) where T : class
        {
            try
            {
                if (pContext.Entry(pEntity).State == EntityState.Detached)
                {
                    pContext.Set <T>().Attach(pEntity);
                }

                pContext.Entry(pEntity).State = EntityState.Modified;
                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }