コード例 #1
0
        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;
            }
        }
コード例 #2
0
        public bool UpdateTag(int id, string newName)
        {
            Tags tag = new Tags { Id = id, Name = newName };

            return dbConnection.Update(tag) == 1;
        }