예제 #1
0
        public async Task <IActionResult> RemoveAsync(string path)
        {
            await _fileStation.DeleteAsync(path, false);

            return(new JsonResult(new ItemModel()
            {
                Path = path
            }));
        }
예제 #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)));
        }