public int AddTag(string name) { var existingTag = dbConnection.Table<Tags>().FirstOrDefault(t => t.Name.ToLower() == name.ToLower()); if (existingTag == null) { Tags tag = new Tags {Name = name}; return dbConnection.Insert(tag); } else { return existingTag.Id; } }
public bool UpdateTag(int id, string newName) { Tags tag = new Tags { Id = id, Name = newName }; return dbConnection.Update(tag) == 1; }