Exemplo n.º 1
0
        public void Delete_WithExistingModel_ShouldRemoveGpu()
        {
            SetUp();

            SeedData();
            var gpu = _context.Gpus.First();

            _gpuService.Delete(gpu.GpuId);

            Assert.DoesNotContain(gpu, _context.Gpus);
        }
Exemplo n.º 2
0
        public IActionResult DeleteConfirmed(int id)
        {
            var    gpu    = _service.GetGpuById(id);
            string imgUrl = gpu.ImgUrl;

            if (imgUrl != Constants.DEFAULT_GPU_IMG)
            {
                _driveService.DeleteFile(gpu.ImgUrl);
            }

            _service.Delete(id);
            return(RedirectToAction(nameof(Index)));
        }