예제 #1
0
 public List<AssemblyItem> LoadAssemblyHistory()
 {
     using (var context = new EntityContext())
     {
         return context.AssemblyItems.ToList();
     }
 }
예제 #2
0
        public void AddAssembly(AssemblyInfo assemblyInfo)
        {
            using (var context = new EntityContext())
            {
                if (!(context.AssemblyItems.Any(o => o.Id == assemblyInfo.Assembly.Id)))
                {
                    context.AssemblyItems.Add(assemblyInfo.Assembly);
                }
                else
                {
                    context.AssemblyItems.Attach(assemblyInfo.Assembly);
                    context.Entry(assemblyInfo.Assembly).State = EntityState.Modified;
                }

                foreach (var historyItem in assemblyInfo.Members)
                {
                    historyItem.AssemblyItem = assemblyInfo.Assembly;
                    if (!(context.AssemblyHistoryItems.Any(o => o.Id == historyItem.Id)))
                    {
                        context.AssemblyHistoryItems.Add(historyItem);
                    }
                    else
                    {
                        context.AssemblyHistoryItems.Attach(historyItem);
                        context.Entry(historyItem).State = EntityState.Modified;
                    }
                }

                context.SaveChanges();
            }
        }
예제 #3
0
 public List<AssemblyHistoryItem> LoadChangesHistory(Guid guid)
 {
     using (var context = new EntityContext())
     {
         return context.AssemblyHistoryItems
             .Where(o => o.AssemblyItem.Id == guid)
             .ToList();
     }
 }