Example #1
0
 public async static Task DeleteInstallationLocation(InstallationLocation itemPara)
 {
     using (var db = new SalesContext())
     {
         db.Entry(itemPara).State = EntityState.Unchanged;   //NOT DELETE - IMPORTANT
         InstallationLocations.Remove(itemPara);
         db.Entry(itemPara).State = EntityState.Deleted;     // must be executed after deleted it in InstallationLocations
         await UpdateDatabase(db);
     }
 }
Example #2
0
 public async static Task DeleteManyInstallationLocations(IList itemParas)
 {
     using (var db = new SalesContext())
     {
         List <InstallationLocation> list = new List <InstallationLocation>();
         foreach (object item in itemParas)
         {
             list.Add((InstallationLocation)item);
         }
         foreach (InstallationLocation item in list)
         {
             db.Entry(item).State = EntityState.Unchanged;
             InstallationLocations.Remove(item);
             db.Entry(item).State = EntityState.Deleted;
         }
         await UpdateDatabase(db);
     }
 }