Ejemplo n.º 1
0
        public static void DeleteProductInstance(ProductInstance instance)
        {
            ProductDal dbProductDal = db.Products.Find(instance.UniqueId);

            if (dbProductDal == null)
            {
                Console.WriteLine("Couldn't find entity to delete!");
            }
            else
            {
                db.Products.Remove(entity: dbProductDal);
                db.SaveChanges();
            }
        }
Ejemplo n.º 2
0
        public static void ReturnBook(string bookId)
        {
            ProductDal dbProductDal = db.Products.Find(bookId);

            if (dbProductDal == null)
            {
                Console.WriteLine("Couldn't find entity to update!");
            }
            else
            {
                dbProductDal.CustomerId = "";
                db.Products.AddOrUpdate(dbProductDal);
                db.SaveChanges();
            }
        }
Ejemplo n.º 3
0
        public static void UpdateProductInstance(ProductInstance instance)
        {
            ProductDal dbProductDal = db.Products.Find(instance.UniqueId);

            if (dbProductDal == null)
            {
                Console.WriteLine("Couldn't find entity to update!");
            }
            else
            {
                dbProductDal.Name  = instance.Name;
                dbProductDal.Genre = instance.TypeId;
                db.Products.AddOrUpdate(dbProductDal);
                db.SaveChanges();
            }
        }