Esempio n. 1
0
        public ProductType SaveType(ProductType c)
        {
            CatalogueDAL catDal = new CatalogueDAL();

            catDal.ProductTypes.AddOrUpdate(c);
            catDal.SaveChanges();
            return(c);
        }
Esempio n. 2
0
        public CatalogueEntry SaveEntry(CatalogueEntry c)
        {
            CatalogueDAL catDal = new CatalogueDAL();

            catDal.CatalogueEntries.AddOrUpdate(c);
            catDal.SaveChanges();
            return(c);
        }
Esempio n. 3
0
        public void UploadTypes(List <ProductType> types)
        {
            CatalogueDAL catDal = new CatalogueDAL();

            foreach (var type in types)
            {
                catDal.ProductTypes.AddOrUpdate(type);
            }
            catDal.SaveChanges();
        }
Esempio n. 4
0
        public void UploadEntries(List <CatalogueEntry> entries)
        {
            CatalogueDAL catDal = new CatalogueDAL();

            foreach (var entry in entries)
            {
                catDal.CatalogueEntries.AddOrUpdate(entry);
            }
            catDal.SaveChanges();
        }
Esempio n. 5
0
        public void RemoveType(string id)
        {
            CatalogueDAL catDal     = new CatalogueDAL();
            var          removeType = catDal.ProductTypes.FirstOrDefault(x => x.UniqueId == id);

            if (removeType == null)
            {
                return;
            }
            catDal.ProductTypes.Remove(removeType);
            catDal.SaveChanges();
            ProductTypes.Remove(id);
        }
Esempio n. 6
0
        public void RemoveEntry(string id)
        {
            CatalogueDAL catDal      = new CatalogueDAL();
            var          removeEntry = catDal.CatalogueEntries.FirstOrDefault(x => x.UniqueId == id);

            if (removeEntry == null)
            {
                return;
            }
            catDal.CatalogueEntries.Remove(removeEntry);
            catDal.SaveChanges();
            CatalogueEntries.Remove(id);
        }