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

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

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

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

            foreach (var entry in entries)
            {
                catDal.CatalogueEntries.AddOrUpdate(entry);
            }
            catDal.SaveChanges();
        }
Ejemplo 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);
        }
Ejemplo 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);
        }
Ejemplo n.º 7
0
        public List <CatalogueEntry> GetEntries()
        {
            CatalogueDAL catDal = new CatalogueDAL();

            return(catDal.CatalogueEntries.ToList());
        }
Ejemplo n.º 8
0
        public List <ProductType> GetTypes()
        {
            CatalogueDAL catDal = new CatalogueDAL();

            return(catDal.ProductTypes.ToList());
        }