Example #1
0
 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);
 }
Example #2
0
 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);
 }
Example #3
0
 public bool UpdateCategory(TB_CategorySurrogate category)
 {
     return(utils.UpdateCategory(category));
 }
Example #4
0
 public bool AddCategory(TB_CategorySurrogate category)
 {
     return(utils.AddCategory(category));
 }