コード例 #1
0
        public IListMgrItem AddListMgrItem(IListMgrItem listMgrItem)
        {
            var sql = @"
                INSERT INTO ListMgrItems (Description) VALUES (@Description);
                SELECT last_insert_rowid()";

            var newId = _connection.Query <int>(sql, listMgrItem).Single();

            return(GetListMgrItem(newId));
        }
コード例 #2
0
        public int UpdateListMgrItem(IListMgrItem listMgrItem)
        {
            var sql = @"UPDATE ListMgrItems SET Description = @Description WHERE ListMgrID = @ListMgrID";

            var affectedRows = _connection.Execute(sql, listMgrItem);

            if (affectedRows == 0)
            {
                throw new NotFoundException();
            }

            return(affectedRows);
        }