Exemplo n.º 1
0
        public async Task <IActionResult> getRandom()
        {
            var ranBook = await managerBook.GetRandomBook();

            UserLibModel temp = new UserLibModel();

            temp.Book = ranBook;
            temp.Page = null;
            List <UserLibModel> libModel = new List <UserLibModel>();

            libModel.Add(temp);

            return(View("Index", libModel));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> getLib(int libOption)
        {
            var userLib = await manager.GetUserLib(libOption, Request.Cookies["Login"]);



            List <UserLibModel> libModel = new List <UserLibModel>();
            UserLibModel        temp     = null;


            switch (libOption)
            {
            case 1:
                foreach (var item in userLib)
                {
                    foreach (var item_2 in item.NowRead)
                    {
                        temp      = new UserLibModel();
                        temp.Book = item_2.Book;
                        temp.Page = item_2.Page;

                        libModel.Add(temp);
                    }
                }
                break;

            case 2:
                foreach (var item in userLib)
                {
                    foreach (var item_2 in item.FinishRead)
                    {
                        temp      = new UserLibModel();
                        temp.Book = item_2.Book;
                        temp.Page = null;

                        libModel.Add(temp);
                    }
                }
                break;

            case 3:
                foreach (var item in userLib)
                {
                    foreach (var item_2 in item.WantRead)
                    {
                        temp      = new UserLibModel();
                        temp.Book = item_2.Book;
                        temp.Page = null;

                        libModel.Add(temp);
                    }
                }
                break;

            case 4:
                foreach (var item in userLib)
                {
                    foreach (var item_2 in item.EndRead)
                    {
                        temp      = new UserLibModel();
                        temp.Book = item_2.Book;
                        temp.Page = item_2.Page;

                        libModel.Add(temp);
                    }
                }
                break;

            default:
                break;
            }

            return(View("Index", libModel));
        }