Beispiel #1
0
 public Collection UpdateCollection(Collection collection)
 {
     if (collection.Products == null)
     {
         _context.Entry(collection).Reference(c => c.Products).IsModified = true;
     }
     _context.Attach(collection).State = EntityState.Modified;
     _context.SaveChanges();
     return(collection);
 }
Beispiel #2
0
 public Product UpdateProduct(Product product)
 {
     if (product.Collection == null)
     {
         _context.Entry(product).Reference(p => p.Collection).IsModified = true;
     }
     _context.Attach(product).State = EntityState.Modified;
     _context.SaveChanges();
     return(product);
 }