public bool DeleteMap(int contentId) { try { var contentTagMaps = GetListMapTagByContent(contentId); _database.RemoveRange(contentTagMaps); _database.SaveChanges(); return(true); } catch (Exception) { return(false); } }
public bool DeleteMapContentCategory(int contentId) { try { var listMap = _database.ContentCategoryMap.Where(n => n.ContentId == contentId); if (listMap != null && listMap.Any()) { _database.RemoveRange(listMap); _database.SaveChanges(); } return(true); } catch (Exception) { return(false); } }
/// <summary> /// Creates entity /// </summary> /// <typeparam name="T"></typeparam> /// <param name="entity"></param> public void Create <T>(TEntity entity) { dbSet.Add(entity); context.SaveChanges(); }