Esempio n. 1
0
        public static SelectPageResult BooksToSelectPageResult(List <BookViewModel> bookList, int booksCount)
        {
            SelectPageResult jsonBooks = new SelectPageResult();

            jsonBooks.Results = new List <SelectResult>();

            foreach (var item in bookList)
            {
                jsonBooks.Results.Add(new SelectResult {
                    id = item.Id.ToString(), text = item.AuthorAndTitle.ToString()
                });
            }

            jsonBooks.Total = booksCount;

            return(jsonBooks);
        }
Esempio n. 2
0
        public static SelectPageResult LanguagesToSelectPageResult(List <LanguageViewModel> languageList, int languagesCount)
        {
            SelectPageResult jsonLanguages = new SelectPageResult();

            jsonLanguages.Results = new List <SelectResult>();

            foreach (var item in languageList)
            {
                jsonLanguages.Results.Add(new SelectResult {
                    id = item.Id.ToString(), text = item.Name.ToString()
                });
            }

            jsonLanguages.Total = languagesCount;

            return(jsonLanguages);
        }
Esempio n. 3
0
        public static SelectPageResult CategoriesToSelectPageResult(List <CategoryViewModel> categoryList, int categoriesCount)
        {
            SelectPageResult jsonCategories = new SelectPageResult();

            jsonCategories.Results = new List <SelectResult>();

            foreach (var item in categoryList)
            {
                jsonCategories.Results.Add(new SelectResult {
                    id = item.Id.ToString(), text = item.Name.ToString()
                });
            }

            jsonCategories.Total = categoriesCount;

            return(jsonCategories);
        }
Esempio n. 4
0
        public static SelectPageResult UsersToSelectPageResult(List <UserViewModel> usersList, int usersCount)
        {
            SelectPageResult jsonUsers = new SelectPageResult();

            jsonUsers.Results = new List <SelectResult>();

            foreach (var item in usersList)
            {
                jsonUsers.Results.Add(new SelectResult {
                    id = item.Id.ToString(), text = item.Username.ToString()
                });
            }

            jsonUsers.Total = usersCount;

            return(jsonUsers);
        }
Esempio n. 5
0
        public static SelectPageResult RolesToSelectPageResult(List <RoleViewModel> rolesList, int rolesCount)
        {
            SelectPageResult jsonRoles = new SelectPageResult();

            jsonRoles.Results = new List <SelectResult>();

            foreach (var item in rolesList)
            {
                jsonRoles.Results.Add(new SelectResult {
                    id = item.Id.ToString(), text = item.Name.ToString()
                });
            }

            jsonRoles.Total = rolesCount;

            return(jsonRoles);
        }
Esempio n. 6
0
        public static SelectPageResult StringsToSelectPageResult(List <string> statusList, int statusCount)
        {
            SelectPageResult jsonItems = new SelectPageResult();

            jsonItems.Results = new List <SelectResult>();

            foreach (var item in statusList)
            {
                jsonItems.Results.Add(new SelectResult {
                    id = item, text = item
                });
            }

            jsonItems.Total = statusCount;

            return(jsonItems);
        }