public ActionResult Move(int fileId = 0, int outDirectoryId = 0, int isDirectory=0) { string userEmail = (string)Session["email"]; string userPassword = (string)Session["password"]; if (userEmail == null || userPassword == null) return RedirectToRoute("Logout"); if (Request.HttpMethod == "POST") { try { FileSystemClient serverFileSystem = new FileSystemClient(); serverFileSystem.Move(fileId, outDirectoryId, isDirectory, userEmail, userPassword); return Json(new { error = "", success = true, id = outDirectoryId }); } catch (Exception ex) { switch(ex.Message) { case "ParentIdIsNull": return Json(new { error = "Выберете каталог назначения!", success = false }); case "DirectoriesHaveSameIDs": return Json(new { error = "Скопировать директорию в саму себя нельзя!", success = false }); case "DirectoryMovedInItSelf": return Json(new { error = "Скопировать директорию в свою вложенную папку нельзя!", success = false }); default: return Json(new { error = ex.Message, success = false }); } } } ViewData["fileId"] = fileId; ViewData["isDirectory"] = isDirectory; ViewData["outDirectoryId"] = outDirectoryId; return View(); }