public bool RemoveByPath(String path) { using (var db = new SQLLite3Context()) { db.TagTable.Where(b => b.Path.Equals(path.ToLower())).DeleteFromQuery(); return(db.SaveChanges() > 0); } }
public bool UpdateAllTag(string oldTag, string newTag) { using (var db = new SQLLite3Context()) { db.TagTable.Where(b => b.Tag.Equals(oldTag.ToLower())) .UpdateFromQuery(x => new TagEntity { Tag = newTag.ToLower(), OriginalTag = newTag }); return(db.SaveChanges() > 0); } }
public bool Add(String tag, String path) { if (IsExist(tag, path)) { return(false); } TagEntity tagEntity = new TagEntity(tag, path); using (var db = new SQLLite3Context()) { db.TagTable.Add(tagEntity); return(db.SaveChanges() > 0); } }
public bool UpdateTag(String path, string oldTag, string newTag) { if (!IsExist(path, oldTag)) { return(false); } using (var db = new SQLLite3Context()) { var tagE = db.TagTable.Where(b => b.Tag.Equals(oldTag.ToLower()) && b.Path.Equals(path.ToLower())).FirstOrDefault(); tagE.Tag = newTag.ToLower(); tagE.OriginalTag = newTag; return(db.SaveChanges() > 0); } }