예제 #1
0
 public void AddCategory(Categories ent)
 {
     var exists = from t in bjDB.Categories
                  where t.CategoryId == ent.CategoryId
                  select t;
     if (exists.Count() == 0)
     {
         bjDB.Categories.InsertOnSubmit(ent);
         AllCategories.Add(ent);
     }
     else
     {
         Categories t = exists.FirstOrDefault();
         t.Title = ent.Title;
         t.OffersCount = ent.OffersCount;
     }
     bjDB.SubmitChanges();
 }
예제 #2
0
 public void DeleteCategory(Categories ent)
 {
     AllCategories.Remove(ent);
     bjDB.Categories.DeleteOnSubmit(ent);
     bjDB.SubmitChanges();
 }