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(); } }
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; }
public int CreateBlogCategory(BlogCategory blogCategory) { base.EbalitDBContext.BlogCategories.Add(blogCategory); base.EbalitDBContext.SaveChanges(); return blogCategory.Id; }