Esempio n. 1
0
        public async Task AddImageForRecord_AfterDeletingTheSame_ShouldUnmarkAsDeleted()
        {
            var(recId, imgId, recImgSvc, imgSvc, context) = await CreateRecordWithLinkedImage();

            context.SoftDeleting = true;

            await recImgSvc.RemoveRecordImage(recId, imgId);

            await recImgSvc.AddRecordImage(recId, imgId);

            int bindedRecordCount = await context.RecordImages.CountAsync(br => br.RecordId == recId && br.ImageId == imgId);

            bindedRecordCount.Should().Be(1);
        }
        public async Task <IActionResult> DeleteRecordImage(Guid recordId, Guid imageId)
        {
            try
            {
                await _recordImagesService.RemoveRecordImage(recordId, imageId);

                return(NoContent());
            }
            catch (Exception exc)
            {
                return(BadRequest(exc.Message));
            }
        }