Exemple #1
0
 public void InsertOrUpdate(ProduceHistory produceHistory)
 {
     if (produceHistory.Id == default(int))
     {
         // New entity
         _context.ProduceHistories.Add(produceHistory);
     }
     else
     {
         // Existing entity
         _context.Entry(produceHistory).State = EntityState.Modified;
     }
 }
Exemple #2
0
 public void Load <TElement>(ProduceHistory produceHistory, Expression <Func <ProduceHistory, ICollection <TElement> > > includeProperty) where TElement : class
 {
     _context.ProduceHistories.Attach(produceHistory);
     _context.Entry(produceHistory).Collection(includeProperty).Load();
 }