private void AddFilament_Click(object sender, RoutedEventArgs e)
 {
     if (!inAddNew)
     {
         ListMenuItem = new FilamentDefn();
         inAddNew     = true;
     }
 }
Example #2
0
 public static void UpdateSpec(FilamentDefn filamentDefn)
 {
     using (FilamentContext ctx = new FilamentContext())
     {
         if (ctx != null && filamentDefn.DensityAlias != null)
         {
             // flag the 'new' objects for added state
             SetDataItemsState(ctx, filamentDefn.DensityAlias.MeasuredDensity.Where(d => d.DensityAliasId == default), EntityState.Added);
             //ctx.Entry<MeasuredDensity>(item).State = EntityState.Added;
             // flag the 'modified' objects for modified state
             SetDataItemsState(ctx, filamentDefn.DensityAlias.MeasuredDensity.Where(d => d.DensityAliasId != default), EntityState.Modified);
             //foreach (var item in filamentDefn.DensityAlias))
             //{
             //    ctx.Entry(item).State= EntityState.Modified;
             //}
             ctx.Update <FilamentDefn>(filamentDefn);
             ctx.SaveChanges();
         }
     }
 }