Exemple #1
0
        public int DeleteCategory(int id)
        {
            tblCategory cat = _db.tblCategories.Where(u => u.id == id).FirstOrDefault();

            _db.tblCategories.Remove(cat);
            return(_db.SaveChanges());
        }
Exemple #2
0
        public int UpdateCategory(CategoryDetails cd)
        {
            tblCategory tc = _db.tblCategories.Where(c => c.CategoryId == cd.CategoryId).FirstOrDefault();

            tc.CategoryName = cd.CategoryName;
            return(_db.SaveChanges());
        }
Exemple #3
0
        public int DeleteCategory(int categoryid)
        {
            tblCategory tc = _db.tblCategories.Where(c => c.CategoryId == categoryid).FirstOrDefault();

            _db.tblCategories.Remove(tc);
            return(_db.SaveChanges());
        }
Exemple #4
0
        public int AddNewCategory(CategoryDetails cd)
        {
            tblCategory tc = new tblCategory();

            tc.CategoryName = cd.CategoryName;
            _db.tblCategories.Add(tc);
            return(_db.SaveChanges());
        }
Exemple #5
0
        public int UpdateCategory(Category model)
        {
            tblCategory cat = _db.tblCategories.Where(u => u.id == model.id).FirstOrDefault();

            cat.id            = model.id;
            cat.category_name = model.category_name;
            cat.status        = model.status;
            return(_db.SaveChanges());
        }
Exemple #6
0
        public int CreateCategory(Category model)
        {
            tblCategory cat = new tblCategory();

            cat.id            = model.id;
            cat.category_name = model.category_name;
            cat.status        = Convert.ToBoolean(model.status);
            _db.tblCategories.Add(cat);
            return(_db.SaveChanges());
        }