public async Task <IActionResult> AddViewsAsync([FromBody] AddVlogViewsDto input) { // Act. var context = new AddVlogViewsContext { VlogViewPairs = input.VlogViewPairs, }; await _vlogService.AddViews(context); // Return. return(NoContent()); }
// 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();
public Task AddViews(AddVlogViewsContext context) => throw new NotImplementedException();
// 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);