Exemplo n.º 1
0
        public async Task SaveCoverArt(CoverArtModel model)
        {
            var existingCoverArt = await GetCoverArt(model.Mbid);

            // Check if a CoverArt already exists, if so, replace it
            if (existingCoverArt == null)
            {
                await InsertCoverArt(model);
            }
            else
            {
                await UpdateCoverArt(existingCoverArt);
            }
        }
Exemplo n.º 2
0
 private async Task InsertCoverArt(CoverArtModel model)
 {
     await _collection.InsertOneAsync(model);
 }
Exemplo n.º 3
0
        private async Task UpdateCoverArt(CoverArtModel model)
        {
            var filter = Builders <CoverArtModel> .Filter.Eq(x => x.Mbid, model.Mbid);

            await _collection.ReplaceOneAsync(filter, model);
        }
Exemplo n.º 4
0
        public async Task <IActionResult> ToggleImageAsCoverArt(CoverArtModel model)
        {
            await _mediator.Send(new ToggleImageAsCoverArt { ImageId = model.ImageId });

            return(Ok());
        }