Exemplo n.º 1
0
        public async Task <IActionResult> RemoveAsync(string path)
        {
            await _fileStation.DeleteAsync(path, false);

            return(new JsonResult(new ItemModel()
            {
                Path = path
            }));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> RemoveAsync(int id)
        {
            var item = _context.Items.FirstOrDefault(i => i.Id == id) ?? throw new ArgumentOutOfRangeException("Item does not exist");

            await _fileStation.DeleteAsync(item.Path, false);

            _context.Items.Remove(item);
            _context.SaveChanges();

            return(new JsonResult(new ItemModel(item)));
        }