public bool UpdateCategory(TB_CategorySurrogate category) { using (MarketDBEntities db = new MarketDBEntities()) { TB_Category c = db.TB_Category.FirstOrDefault(q => q.CategoryID == category.CategoryID); if (c != null) { c.CategoryName = category.CategoryName; db.SaveChanges(); return(true); } } return(false); }
public bool AddCategory(TB_CategorySurrogate category) { using (MarketDBEntities db = new MarketDBEntities()) { TB_Category c = new TB_Category(); if (db.TB_Category.FirstOrDefault(q => q.CategoryName == category.CategoryName) == null) { c.CategoryName = category.CategoryName; db.TB_Category.Add(c); db.SaveChanges(); return(true); } } return(false); }
public bool UpdateCategory(TB_CategorySurrogate category) { return(utils.UpdateCategory(category)); }
public bool AddCategory(TB_CategorySurrogate category) { return(utils.AddCategory(category)); }