示例#1
0
        public async Task <IActionResult> AddViewsAsync([FromBody] AddVlogViewsDto input)
        {
            // Act.
            var context = new AddVlogViewsContext
            {
                VlogViewPairs = input.VlogViewPairs,
            };
            await _vlogService.AddViews(context);

            // Return.
            return(NoContent());
        }
示例#2
0
        // FUTURE: Check if the current user is allowed to watch the requested vlog.
        /// <summary>
        ///     Adds views for given vlogs.
        /// </summary>
        /// <param name="viewsContext">Context for adding vlog views.</param>
        public async Task AddViews(AddVlogViewsContext viewsContext)
        {
            if (viewsContext is null)
            {
                throw new ArgumentNullException(nameof(viewsContext));
            }

            var sql = "";

            foreach (var(vlogId, views) in viewsContext.VlogViewPairs)
            {
                sql = ExtendSql(sql, vlogId, views);
            }

            await using var context = await CreateNewDatabaseContext(sql);

            await context.NonQueryAsync();
示例#3
0
 public Task AddViews(AddVlogViewsContext context) => throw new NotImplementedException();
示例#4
0
 // FUTURE: Check if the user is allowed to watch the vlog
 /// <summary>
 ///     Adds views for given vlogs.
 /// </summary>
 /// <param name="context">Context for adding vlog views.</param>
 public Task AddViews(AddVlogViewsContext context)
 => _vlogRepository.AddViews(context);