示例#1
0
 public void UpdateBlogCategory(BlogCategory blogCategory)
 {
     var originalRecord = base.EbalitDBContext.BlogCategories.Find(blogCategory.Id);
     if (originalRecord != null)
     {
         base.EbalitDBContext.Entry(originalRecord).CurrentValues.SetValues(blogCategory);
         base.EbalitDBContext.SaveChanges();
     }
 }
示例#2
0
 public bool DeleteBlogCategory(BlogCategory  blogCategory)
 {
     bool result = true;
     var originalRecord = base.EbalitDBContext.BlogCategories.Find(blogCategory.Id);
     if (originalRecord != null)
     {
         try
         {
             base.EbalitDBContext.BlogCategories.Remove(originalRecord);
             base.EbalitDBContext.SaveChanges();
         }
         catch (Exception ex)
         {
             result = false;
         }
     }
     return result;
 }
示例#3
0
 public int CreateBlogCategory(BlogCategory blogCategory)
 {
     base.EbalitDBContext.BlogCategories.Add(blogCategory);
     base.EbalitDBContext.SaveChanges();
     return blogCategory.Id;
 }