Exemple #1
0
        public async Task <ApiResult <bool> > RemoveImage(int ImageId)
        {
            var image = await _context.ProductImages.FindAsync(ImageId);

            if (image == null)
            {
                return(new ApiResultErrors <bool>($"Can not find image with id: {ImageId}"));
            }
            _context.ProductImages.Remove(image);
            return(await SaveChangeService.SaveChangeAsyncImage(_context, image.ImagePath, _storageService));
        }
Exemple #2
0
        public async Task <ApiResult <bool> > Delete(int categorytId)
        {
            var category = await _context.Categories.FindAsync(categorytId);

            if (category == null)
            {
                return(new ApiResultErrors <bool>($"Can not find Category with id: {categorytId}"));
            }
            _context.Categories.Remove(category);
            return(await SaveChangeService.SaveChangeAsyncImage(_context, category.ImagePath, _storageService));
        }
        public async Task <ApiResult <bool> > Delete(int blogId)
        {
            var blog = await _context.Blogs.FindAsync(blogId);

            if (blog == null)
            {
                return(new ApiResultErrors <bool>($"Can not find blog with id: {blogId}"));
            }
            _context.Blogs.Remove(blog);
            return(await SaveChangeService.SaveChangeAsyncImage(_context, blog.ImagePath, _storageService));
        }