Exemplo n.º 1
0
        public IActionResult GetAllByUser(int page = 1)
        {
            int pageSize = 30;
            var user     = _userService.GetUserByUserName(User.Identity.Name).Data;
            var list     = _noteService.GetByUserId(user.Id).Data;

            NoteListViewModel model = new NoteListViewModel
            {
                Notes       = PagingListSelectBySearch.SelectList(list, null, page, pageSize),
                PageCount   = PagingListSelectBySearch.GetPageCount(list, null, pageSize),
                PageSize    = pageSize,
                CurrentPage = page
            };

            return(View("GetAll", model));
        }
        public IActionResult Index(string search = null, int page = 1)
        {
            int pageSize     = 30;
            var questions    = _questionService.GetAll().Data;
            var searchedList = questions.Where(x => search != null && x.QuestionContent.ToLower().Contains(search.ToLower())).ToList();

            QuestionListViewModel model = new QuestionListViewModel
            {
                Questions   = PagingListSelectBySearch.SelectList(questions, searchedList, page, pageSize),
                PageCount   = PagingListSelectBySearch.GetPageCount(questions, searchedList, pageSize),
                PageSize    = pageSize,
                CurrentPage = page
            };

            return(View(model));
        }
Exemplo n.º 3
0
        public IActionResult Students(string searchString = null, int page = 1)
        {
            int pageSize     = 50;
            var list         = _roleService.GetUsersInRoleName("Student").Data;
            var searchedList = list.Where(x => searchString != null &&
                                          (x.Email.ToLower().Contains(searchString.ToLower()) ||
                                           x.UserName.ToLower().Contains(searchString.ToLower())
                                          )).ToList();

            UserListViewModel model = new UserListViewModel
            {
                Users       = PagingListSelectBySearch.SelectList(list, searchedList, page, pageSize),
                PageCount   = PagingListSelectBySearch.GetPageCount(list, searchedList, pageSize),
                PageSize    = pageSize,
                CurrentPage = page
            };

            ViewBag.title = "Öğrenciler";
            return(View("Index", model));
        }
Exemplo n.º 4
0
        public IActionResult GetAll(int page = 1)
        {
            int pageSize = 30;
            var list     = _noteService.GetAll().Data;

            List <UserDto> users = new List <UserDto>();

            foreach (var note in list)
            {
                users.Add(_userService.GetByUserId(note.UserId).Data);
            }

            NoteListViewModel model = new NoteListViewModel
            {
                Notes       = PagingListSelectBySearch.SelectList(list, null, page, pageSize),
                Users       = users,
                PageCount   = PagingListSelectBySearch.GetPageCount(list, null, pageSize),
                PageSize    = pageSize,
                CurrentPage = page
            };

            return(View(model));
        }