Exemple #1
0
 public NAPClientPatch AddClientPatchData(NAPClientPatch patchatClient)
 {
     try
     {
         using (var dbContext = new NAPClientDbContext())
         {
             dbContext.Configuration.AutoDetectChangesEnabled = true;
             dbContext.Configuration.LazyLoadingEnabled       = false;
             var result = dbContext.NAPClientPatches.Add(patchatClient);
             dbContext.SaveChanges();
             return(result);
         }
     }
     catch (Exception ex)
     {
         _log.Error(ex, "Failed to get client patch data by{0}", patchatClient);
         throw;
     }
 }
Exemple #2
0
 public bool UpdateClientPatchData(NAPClientPatch patchatClient)
 {
     try
     {
         using (var dbContext = new NAPClientDbContext())
         {
             //dbContext.Configuration.AutoDetectChangesEnabled = true;
             //dbContext.Configuration.LazyLoadingEnabled = false;
             var find = dbContext.NAPClientPatches.FirstOrDefault(x => x.PatchScriptId == patchatClient.PatchScriptId);
             if (find == null)
             {
                 return(false);
             }
             dbContext.Set <NAPClientPatch>().AddOrUpdate(patchatClient);
             dbContext.SaveChanges();
             return(true);
         }
     }
     catch (Exception ex)
     {
         _log.Error(ex, "Failed to get client patch data by{0}", patchatClient);
         throw;
     }
 }