public override void HandleRequest(string jsonString, AjaxBase ajax)
        {
            if (!User.IsAdminLoggedIn(ajax))
            {
                ajax.Unauthorized();
                return;
            }

            AdminMangaEditPathRequest request = Utility.ParseJson<AdminMangaEditPathRequest>(jsonString);
            Manga manga = Manga.GetById(request.id);

            if (manga == null)
            {
                ajax.BadRequest();
                return;
            }

            AdminMangaEditPathResponse response = new AdminMangaEditPathResponse();

            if (request.path == null || request.path == "")
            {
                response.path = manga.MangaPath;
                response.cid = manga.ParentCollectionId;
            }
            else
            {
                int mangaType;

                if ((request.path = Manga.CheckMangaPath(request.path)) == null || !Utility.IsValidStringForDatabase(request.path))
                {
                    response.status = 1;
                }
                else if (request.path.IndexOf(manga.ParentCollection.Path, StringComparison.InvariantCultureIgnoreCase) != 0)
                {
                    ajax.BadRequest();
                    return;
                }
                else if ((mangaType = Manga.CheckMangaType(request.path)) == -1)
                {
                    response.status = 3;
                }
                else
                {
                    response.status = 0;
                    manga.ChangePath(request.path, mangaType);
                }
            }

            ajax.ReturnJson(response);
        }
 private void GetMangaSuccess(AdminMangaEditPathResponse response)
 {
     Show();
     jQuery.Select("#admin-manga-edit-path").Value(response.path).Focus();
     collectionId = response.cid;
 }
        private void SubmitSuccess(AdminMangaEditPathResponse response)
        {
            submittingForm = false;

            switch (response.status)
            {
                case 0:
                    Hide();
                    mangasModule.Refresh();
                    break;
                case 1:
                    ErrorModal.ShowError(Strings.Get("FileNotFoundOrAlreadyAdded"));
                    break;
                case 3:
                    ErrorModal.ShowError(Strings.Get("InvalidFileType"));
                    break;
                default:
                    ErrorModal.ShowError(Strings.Get("UnknownError"));
                    break;
            }
        }