Exemplo n.º 1
0
        public async Task <IActionResult> Post(string path, [FromBody] AppendFolderViewModel model)
        {
            if (ModelState.IsValid == false)
            {
                return(BadRequest(ModelState));
            }

            var folder = await _storage.FindFolderAsync(path);

            if (folder == null)
            {
                return(NotFound());
            }

            await _storage.AddFolderAsync(folder, model.Name);

            return(Ok());
        }
Exemplo n.º 2
0
        public async Task <IActionResult> MakeDirectory([FromRoute] string path, [FromForm] AppendFolderViewModel model)
        {
            if (!ModelState.IsValid)
            {
                TempData[ERROR_MESSAGES] = "InvalidRequest";
            }

            var folder = await _storage.FindFolderAsync(path ?? string.Empty);

            if (folder == null)
            {
                TempData[ERROR_MESSAGES] = $"NotFound:{path}";
            }

            await _storage.AddFolderAsync(folder, model.Name);

            TempData[SUCCESS_MESSAGES] = $"Mkdir:{path}";

            return(RedirectToIndexWithQueryString());
        }