Inheritance: JsonResponse
        public override void HandleRequest(string jsonString, AjaxBase ajax)
        {
            MangaReadRequest request = Utility.ParseJson<MangaReadRequest>(jsonString);
            MangaReadResponse response = new MangaReadResponse();

            Manga manga = Manga.GetById(request.id);
            Manga nextManga = Manga.GetById(request.nextId);

            if (manga == null || !manga.ParentCollection.Accessible(ajax))
            {
                response.id = -1;
            }
            else
            {
                response.id = manga.Id;
                response.pages = manga.NumberOfPages;
                response.ltr = manga.LeftToRight;
                manga.IncreaseViewCount();
            }

            if (nextManga == null || !nextManga.ParentCollection.Accessible(ajax))
            {
                response.nextId = -1;
            }
            else
            {
                response.nextId = nextManga.Id;
            }

            ajax.ReturnJson(response);
        }
Esempio n. 2
0
 private void ReadRequestSuccess(MangaReadResponse response)
 {
     sendingReadReqeust = false;
     ReadModule.ReadManga(response);
 }
Esempio n. 3
0
        public void Read(MangaReadResponse manga)
        {
            this.manga = manga;
            if (manga.nextId == -1)
            {
                jQuery.Select("#read-next-btn").Hide();
            }
            else
            {
                jQuery.Select("#read-next-btn").Show();
            }

            Show(delegate
            {
                CurrentPage = -1;
                InitializeRead();
            });
        }
Esempio n. 4
0
 public static void ReadManga(MangaReadResponse manga)
 {
     if (manga.id == -1)
     {
         ErrorModal.ShowError(Strings.Get("MangaNotAvailable"));
     }
     else
     {
         Instance.Read(manga);
     }
 }