예제 #1
0
        async Task UpdateTotalViewsAsync(TEntity entity)
        {
            // Sql query
            const string sql = "UPDATE {prefix}_Entities SET TotalViews = {views} WHERE Id = {id};";

            // Execute and return results
            await _dbHelper.ExecuteScalarAsync <int>(sql, new Dictionary <string, string>()
            {
                ["{id}"]    = entity.Id.ToString(),
                ["{views}"] = (entity.TotalViews += 1).ToString()
            });

            _entityStore.CancelTokens(entity);
        }