public int DeleteCategory(int id) { tblCategory cat = _db.tblCategories.Where(u => u.id == id).FirstOrDefault(); _db.tblCategories.Remove(cat); return(_db.SaveChanges()); }
public int UpdateCategory(CategoryDetails cd) { tblCategory tc = _db.tblCategories.Where(c => c.CategoryId == cd.CategoryId).FirstOrDefault(); tc.CategoryName = cd.CategoryName; return(_db.SaveChanges()); }
public int DeleteCategory(int categoryid) { tblCategory tc = _db.tblCategories.Where(c => c.CategoryId == categoryid).FirstOrDefault(); _db.tblCategories.Remove(tc); return(_db.SaveChanges()); }
public int AddNewCategory(CategoryDetails cd) { tblCategory tc = new tblCategory(); tc.CategoryName = cd.CategoryName; _db.tblCategories.Add(tc); return(_db.SaveChanges()); }
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()); }
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()); }