Esempio n. 1
0
        public bool DeleteProductImage(int productImageID)
        {
            var productImage = dbContext.ProductImages.Find(productImageID);

            if (productImage != null)
            {
                //found the productImage with given id
                dbContext.Entry(productImage).State = EntityState.Deleted;
                dbContext.SaveChanges();
                return(true);
            }
            else
            {
                //cannot find the productImage with given id
                return(false);
            }
        }
Esempio n. 2
0
        public bool Delete(int subcategoryID)
        {
            var subcategory = dbContext.SubCategories.Find(subcategoryID);

            if (subcategory != null)
            {
                //found the subcategory with given id
                dbContext.Entry(subcategory).State = EntityState.Deleted;
                dbContext.SaveChanges();
                return(true);
            }
            else
            {
                //cannot find the subcategory with given id
                return(false);
            }
        }
Esempio n. 3
0
        public bool Delete(int categoryID)
        {
            var category = dbContext.Categories.Find(categoryID);

            //var category = new DataModels.Category { CategoryID = 1 };
            if (category != null)
            {
                //found the category with given id
                dbContext.Entry(category).State = EntityState.Deleted;
                dbContext.SaveChanges();
                return(true);
            }
            else
            {
                //cannot find the category with given id
                return(false);
            }
        }