Exemplo n.º 1
0
        public static PagedListModel ToPagedList(this ListModel returnList, PagingModel paging)
        {
            var pagedList = new PagedListModel()
            {
                BranchId       = returnList.BranchId,
                IsContractList = returnList.IsContractList,
                IsFavorite     = returnList.IsFavorite,
                IsMandatory    = returnList.IsMandatory,
                IsRecommended  = returnList.IsRecommended,
                IsReminder     = returnList.IsReminder,
                IsShared       = returnList.IsShared,
                IsSharing      = returnList.IsSharing,
                IsWorksheet    = returnList.IsWorksheet,
                ListId         = returnList.ListId,
                Name           = returnList.Name,
                ReadOnly       = returnList.ReadOnly,
                SharedWith     = returnList.SharedWith,
                Type           = returnList.Type
            };

            if (returnList.Items != null)
            {
                pagedList.Items = returnList.Items.AsQueryable <ListItemModel>().GetPage <ListItemModel>(paging, "Position");
            }

            return(pagedList);
        }
Exemplo n.º 2
0
        // GET: BlogPosts/Details/5
        public ActionResult Details(int?id, int page = 1)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            BlogPost blogPost = Repo.GetById((int)id);

            if (blogPost == null)
            {
                return(HttpNotFound());
            }

            var sanitizer = new HtmlSanitizer();

            blogPost.PostContent = sanitizer.Sanitize(blogPost.PostContent);
            //blogPost.PostContent =Server.HtmlDecode(Server.HtmlEncode(blogPost.PostContent));

            IEnumerable <PostComment> postComments;
            int PageSize   = 10;
            int TotalCount = CommentRepo.CountCommentsAsync((int)id);

            postComments = CommentRepo.Get(o => o.BlogpostId == id, o => o.OrderByDescending(i => i.DateOfComment), "", PageSize, (PageSize * (page - 1)));
            int pageCount = (TotalCount % PageSize == 0 ? TotalCount / PageSize : (TotalCount / PageSize + 1));
            var result    = new PagedListModel <PostComment>(postComments, TotalCount, pageCount, page);


            PostViewModel postView = new PostViewModel(result, blogPost);

            return(View(postView));
        }
Exemplo n.º 3
0
 /// <summary>
 /// Gets all customer.
 /// </summary>
 /// <param name="customerId">The customer identifier.</param>
 /// <param name="column">The column.</param>
 /// <param name="direction">The direction.</param>
 /// <param name="page">The page.</param>
 /// <param name="limit">The limit.</param>
 /// <param name="isDelete">The is delete.</param>
 /// <param name="status">The status.</param>
 /// <param name="searchString">The search string.</param>
 /// <returns></returns>
 /// <exception cref="NotImplementedException"></exception>
 public PagedListModel <CustomerListModel> GetAllCustomer(long customerId = 0, string column = "", string direction = "", int page = Constants.DefaultPageNo, long limit = Constants.DefaultLimit, int isDelete = Constants.DefaultIsDelete, int status = Constants.DefaultIsStatus, string searchString = "")
 {
     try
     {
         PagedListModel <CustomerListModel> customerData = new PagedListModel <CustomerListModel>();
         var parameter = DBHelper.GetDefaultParameter(column, direction, page, limit, isDelete, status, searchString);
         if (customerId > 0)
         {
             parameter.Add(new SqlParameter("CustomerId", customerId));
         }
         DataSet dsCustomer = DBHelper.GetDataTable(StoredProcedure.CustomerList, parameter.ToArray(), DBHelper.ParseString(_settings.Value.AppDbContext));
         if (dsCustomer != null && dsCustomer.Tables.Count > 0)
         {
             DataTable dtCustomer = dsCustomer.Tables[0];
             DataTable dtTotal    = dsCustomer.Tables[1];
             customerData.Data  = CustomerHelper.BindCustomerListModel(dtCustomer);
             customerData.Count = DBHelper.ParseInt64(dtTotal.Rows[0][0]);
             customerData.Limit = DBHelper.ParseInt64(limit);
             customerData.Page  = DBHelper.ParseInt32(page);
         }
         return(customerData);
     }
     catch (Exception ex)
     {
         LogHelper.ExceptionLog(ex.Message + Constants.ExceptionSeprator + ex.StackTrace);
         throw ex;
     }
 }
Exemplo n.º 4
0
        public PagedListModel <TwoHourCapacityDTO> GetTotalCapacity()
        {
            var modelList = ElectricalBoardDTRepository.GetTwoHourTotalCapacity();
            var result    = new PagedListModel <TwoHourCapacityDTO>(modelList.Count, modelList);

            return(result);
        }
Exemplo n.º 5
0
        public ActionResult Index(int?key)
        {
            var pageIndex = (key ?? 1);
            int total;
            IEnumerable <Domain.Entities.Profile> profiles;

            if (KatushaProfile == null)
            {
                profiles = ProfileService.GetNewProfiles(p => p.ProfilePhotoGuid != Guid.Empty, out total, pageIndex, DependencyConfig.GlobalPageSize);
            }
            else
            {
                if (KatushaProfile.Gender == (byte)Sex.Female)
                {
                    profiles = ProfileService.GetNewProfiles(p => p.Gender == (byte)Sex.Male, out total, pageIndex, DependencyConfig.GlobalPageSize);
                }
                else
                {
                    profiles = ProfileService.GetNewProfiles(p => p.Gender == (byte)Sex.Female, out total, pageIndex, DependencyConfig.GlobalPageSize);
                }
            }
            var profilesModel        = Mapper.Map <IEnumerable <ProfileModel> >(profiles);
            var profilesAsIPagedList = new StaticPagedList <ProfileModel>(profilesModel, pageIndex, DependencyConfig.GlobalPageSize, total);
            var model = new PagedListModel <ProfileModel> {
                List = profilesAsIPagedList, Total = total
            };

            return(View(model));
        }
Exemplo n.º 6
0
        public ActionResult Photos(string key)
        {
            int total;
            int pageNo;

            if (!int.TryParse(key, out pageNo))
            {
                pageNo = 1;
            }
            var list       = _photosService.AllPhotos(out total, "0-", pageNo, DependencyConfig.GlobalPageSize);
            var pagedList  = new StaticPagedList <Guid>(list, pageNo, DependencyConfig.GlobalPageSize, total);
            var photoGuids = new PagedListModel <Guid> {
                List = pagedList, Total = total
            };
            var dictionaryPhotos   = new Dictionary <Guid, PhotoModel>();
            var dictionaryProfiles = new Dictionary <Guid, ProfileModel>();

            foreach (var guid in list)
            {
                var photo = _photosService.GetByGuid(guid);
                if (photo != null)
                {
                    dictionaryPhotos.Add(guid, Mapper.Map <PhotoModel>(photo));
                    dictionaryProfiles.Add(guid, Mapper.Map <ProfileModel>(ProfileService.GetProfile(photo.ProfileId)));
                }
            }
            var model = new UtilitiesPhotosModel {
                PhotoGuids = photoGuids, Photos = dictionaryPhotos, Profiles = dictionaryProfiles
            };

            return(View(model));
        }
Exemplo n.º 7
0
        public PagedListModel <Machine_CustomerDTO> QueryMachine_CustomerInfo(Machine_CustomerDTO searchModel, Page page)
        {
            int totalcount;
            var result = machine_YieldRepository.QueryMachine_CustomerInfo(searchModel, page, out totalcount).ToList();
            var bd     = new PagedListModel <Machine_CustomerDTO>(totalcount, result);

            return(bd);
        }
Exemplo n.º 8
0
        public PagedListModel <GL_QATargetYieldDTO> QueryGLQAYields(GL_QATargetYieldDTO searchModel, Page page)
        {
            int totalcount;
            var result = gL_QATargetYieldRepository.QueryGLQAYields(searchModel, page, out totalcount).ToList();
            var bd     = new PagedListModel <GL_QATargetYieldDTO>(totalcount, result);

            return(bd);
        }
Exemplo n.º 9
0
        public PagedListModel <CNCMachineDTO> QueryCNCMachineDTOs(CNCMachineDTO searchModel, Page page)
        {
            int totalcount;
            var result = CNCMachineRepository.QueryCNCMachineDTOs(searchModel, page, out totalcount).ToList();
            var bd     = new PagedListModel <CNCMachineDTO>(totalcount, result);

            return(bd);
        }
Exemplo n.º 10
0
        /// <summary>
        /// Gets the user list.
        /// </summary>
        /// <returns></returns>
        public PagedListModel <UserListModel> GetUserList(SearchPaginationListModel searchModel)
        {
            PagedListModel <UserListModel> userListModel = new PagedListModel <UserListModel>();

            try
            {
                SqlParameter[] parameters = new SqlParameter[6];
                parameters[0] = new SqlParameter("PAGENO", searchModel.pageNo);
                parameters[1] = new SqlParameter("RECORDPERPAGE", searchModel.limit);
                parameters[2] = new SqlParameter("SEARCHSTRING", searchModel.searchString);
                parameters[3] = new SqlParameter("COLUMN", searchModel.column);
                parameters[4] = new SqlParameter("DIRECTION", searchModel.direction);
                parameters[5] = new SqlParameter("STATUS", searchModel.Status);
                DataSet ds = DBHelper.GetDataTable("GETUSERLIST", parameters, DBHelper.ParseString(settings.Value.AppDbContext));
                if (ds != null && ds.Tables != null && ds.Tables.Count > 0)
                {
                    DataTable dt = ds.Tables[0];
                    userListModel.Items = new List <UserListModel>();
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        foreach (DataRow model in dt.Rows)
                        {
                            UserListModel uModel = new UserListModel();
                            if (DBHelper.ParseString(model["RoleType"]).Equals(1))
                            {
                                uModel.IsAdmin = "1";
                            }

                            uModel.UserId           = DBHelper.ParseInt64(DBHelper.ParseString(model["UserId"]));
                            uModel.FirstName        = DBHelper.ParseString(model["FirstName"]);
                            uModel.LastName         = DBHelper.ParseString(model["LastName"]);
                            uModel.CompanyName      = DBHelper.ParseString(model["Companyname"]);
                            uModel.EmailAddress     = DBHelper.ParseString(model["EmailAddress"]);
                            uModel.PhoneNumber      = DBHelper.ParseString(model["PhoneNumber"]);
                            uModel.Status           = DBHelper.ParseInt32(model["Status"]);
                            uModel.RoleType         = DBHelper.ParseInt32(model["RoleType"]);
                            uModel.UserAddressCount = DBHelper.ParseInt32(model["UserAddressCount"]);
                            userListModel.Items.Add(uModel);
                        }
                    }

                    DataTable dt1 = ds.Tables[1];
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        var row = dt1.Rows[0];
                        userListModel.Total = DBHelper.ParseInt32(row["Total"]);
                    }
                }

                //return context.User.Include(x => x.Country).Include(x => x.State).Where(x => x.IsDelete == false).ToList();
            }
            catch (Exception ex)
            {
                LogHelper.ExceptionLog(ex.Message + "  :::::  " + ex.StackTrace);
                throw ex;
            }
            return(userListModel);
        }
Exemplo n.º 11
0
        public ActionResult LoadPublisherList(string searchText, int page = 1)
        {
            PagedListModel <PublisherListModel> model = new PagedListModel <PublisherListModel>();

            model.CurrentList       = _publisherService.SearchPublisherByNameWithPaging(searchText, page, model.PageSize, out int totalItemCount);
            model.TotalItemCount    = totalItemCount;
            model.CurrentPageNumber = page;
            return(PartialView("_PublisherListPartial", model));
        }
Exemplo n.º 12
0
        public ActionResult Index(int page = 1)
        {
            PagedListModel <CategoryListPagingModel> model = new PagedListModel <CategoryListPagingModel>();

            model.CurrentList       = _categoryService.GetAllWithPaging(out int totalItemCount);
            model.TotalItemCount    = totalItemCount;
            model.CurrentPageNumber = page;
            return(View(model));
        }
Exemplo n.º 13
0
        public PartialViewResult LoadCategoryList(string searchText, int page = 1)
        {
            PagedListModel <CategoryListPagingModel> model = new PagedListModel <CategoryListPagingModel>();

            model.CurrentList       = _categoryService.SearchCategoryByTitleWithPaging(searchText, page, model.PageSize, out int totalItemCount);
            model.TotalItemCount    = totalItemCount;
            model.CurrentPageNumber = page;
            return(PartialView("_CategoryListPartial", model));
        }
Exemplo n.º 14
0
        public PartialViewResult LoadAuthorList(string searchText, int page = 1)
        {
            PagedListModel <AuthorListModel> model = new PagedListModel <AuthorListModel>();

            model.CurrentList       = _authorService.SearchAuthorByNameWithPaging(searchText, page, model.PageSize, out int totalItemCount);
            model.TotalItemCount    = totalItemCount;
            model.CurrentPageNumber = page;
            return(PartialView("_AuthorListPartial", model));
        }
Exemplo n.º 15
0
        public IHttpActionResult GetIntervalInfoAPI()
        {
            List <IntervalEnum> items = new List <IntervalEnum>();
            var item = EventReportManagerService.GetIntervalInfo("OP1");

            items.Add(item);
            var list = new PagedListModel <IntervalEnum>(0, items);

            return(Ok(list));
        }
Exemplo n.º 16
0
        public PartialViewResult LoadFilteredResults(SearchModel filter, int page = 1)
        {
            PagedListModel <FilteredBookListModel> model = new PagedListModel <FilteredBookListModel>();

            model.CurrentList       = _bookService.GetFilteredBookList(filter, page, model.PageSize, out var totalItemCount);
            model.TotalItemCount    = totalItemCount;
            model.CurrentPageNumber = page;

            return(PartialView("_BookListPartial", model));
        }
Exemplo n.º 17
0
        public PagedListModel <Movie> Search(SearchParamters paramters)
        {
            if (!paramters.HasQuery)
            {
                return(PagedListModel <Movie> .Empty <Movie>());
            }

            var movies = _cache.Get(() => _rottenTomatoes.SearchMovies(paramters), paramters.GetCacheKey());

            return(new PagedListModel <Movie>(movies.Select(m => m.ToMovie()), paramters.PageNumber, paramters.PageSize));
        }
Exemplo n.º 18
0
        public ActionResult Index()
        {
            int total;
            var items           = _service.GetAll(out total, 1, PageSize);
            var pagedList       = new StaticPagedList <T>(items, 1, DependencyConfig.GlobalPageSize, total);
            var itemsIndexModel = new PagedListModel <T> {
                List = pagedList, Total = total
            };

            return(View(itemsIndexModel));
        }
Exemplo n.º 19
0
        public IActionResult ContentList(SearchPaginationListModel searchModel)
        {
            try
            {
                if (searchModel.pageNo <= 0)
                {
                    searchModel.pageNo = 1;
                }
                var contentList = iContent.ContentDetails(searchModel.searchString);
                if (contentList != null)
                {
                    List <ContentDetails> contentDetailsResult = new List <ContentDetails>();

                    #region Sorting
                    if (searchModel.column.ToLower().Equals(DBHelper.ParseString(SortContentType.contentid)) && searchModel.direction.ToLower().Equals(DBHelper.ParseString(SortingDirectionType.asc)))
                    {
                        contentDetailsResult = contentList.OrderBy(x => x.ContentId).ToPagedList(searchModel.pageNo, searchModel.limit).ToList();
                    }
                    else if (searchModel.column.ToLower().Equals(DBHelper.ParseString(SortContentType.name)) && searchModel.direction.ToLower().Equals(DBHelper.ParseString(SortingDirectionType.desc)))
                    {
                        contentDetailsResult = contentList.OrderByDescending(x => x.Name).ToPagedList(searchModel.pageNo, searchModel.limit).ToList();
                    }
                    else if (searchModel.column.ToLower().Equals(DBHelper.ParseString(SortContentType.contentid)) && searchModel.direction.ToLower().Equals(DBHelper.ParseString(SortingDirectionType.desc)))
                    {
                        contentDetailsResult = contentList.OrderByDescending(x => x.ContentId).ToPagedList(searchModel.pageNo, searchModel.limit).ToList();
                    }
                    else if (searchModel.column.ToLower().Equals(DBHelper.ParseString(SortContentType.name)) && searchModel.direction.ToLower().Equals(DBHelper.ParseString(SortingDirectionType.asc)))
                    {
                        contentDetailsResult = contentList.OrderBy(x => x.Name).ToPagedList(searchModel.pageNo, searchModel.limit).ToList();
                    }
                    else
                    {
                        contentDetailsResult = contentList.OrderBy(x => x.ContentId).ToPagedList(searchModel.pageNo, searchModel.limit).ToList();
                    }
                    #endregion

                    ////var contentPagedResult = contentList.OrderByDescending(x => x.ContentId).ToPagedList(searchModel.pageNo, searchModel.limit).ToList();
                    List <AddContentModel>          addContentModelList = ContentHelper.BindAddContentModel(contentDetailsResult);
                    PagedListModel <ContentDetails> pagedListModel      = new PagedListModel <ContentDetails>();
                    pagedListModel.Items = contentDetailsResult.ToList();
                    pagedListModel.Total = DBHelper.ParseInt32(contentList.Count);
                    return(Ok(ResponseHelper.Success(pagedListModel)));
                }
                else
                {
                    return(Ok(ResponseHelper.Error(MessageConstants.ContentNotFound)));
                }
            }
            catch (Exception ex)
            {
                LogHelper.ExceptionLog(ex.Message + "  :::::  " + ex.StackTrace);
                return(Ok(ResponseHelper.Error(ex.Message)));
            }
        }
Exemplo n.º 20
0
        protected override IActionResult RenderIndex(PagedListModel <RoleReadModel, RoleFilteredPagedQueryModel> model)
        {
            var indexModel = new RoleIndexViewModel
            {
                PagedList = model,
                // Permissions=
            };

            return(Request.IsAjaxRequest()
                ? (IActionResult)PartialView(indexModel)
                : View(indexModel));
        }
Exemplo n.º 21
0
        public ActionResult Index(int page = 1)
        {
            IEnumerable <User> Users;
            int PageSize   = 10;
            int TotalCount = Logic.CountUsers();

            Users = Logic.GetAll(null, o => o.OrderBy(i => i.Id), "Roles", PageSize, (PageSize * (page - 1)));
            int pageCount = (TotalCount % PageSize == 0 ? TotalCount / PageSize : (TotalCount / PageSize + 1));
            var result    = new PagedListModel <User>(Users, TotalCount, pageCount, page);

            return(View(result));
        }
Exemplo n.º 22
0
        public async Task <PagedListModel <ApplicationUser> > GetUsers(UserSearchModel userSearchModel)
        {
            PagedListModel <ApplicationUser> users = new PagedListModel <ApplicationUser>();

            IList <ApplicationUser> applicationUsers = null;
            int count = 0;

            if (string.IsNullOrEmpty(userSearchModel.RoleName))
            {
                count = await userManager.Users
                        .Where(w => (string.IsNullOrEmpty(userSearchModel.FullName) || w.FullName.Contains(userSearchModel.FullName)) &&
                               (string.IsNullOrEmpty(userSearchModel.Email) || w.Email == userSearchModel.Email) &&
                               (!userSearchModel.IsDeleted.HasValue || w.IsDeleted == userSearchModel.IsDeleted || (userSearchModel.IsDeleted == false && w.IsDeleted != true))
                               //Excluding users without Email address (API Accounts)
                               && !string.IsNullOrEmpty(w.Email))
                        .CountAsync();

                applicationUsers = await userManager.Users.Include("ApplicationUserRoles.Role")
                                   .Where(w => (string.IsNullOrEmpty(userSearchModel.FullName) || w.FullName.Contains(userSearchModel.FullName)) &&
                                          (string.IsNullOrEmpty(userSearchModel.Email) || w.Email == userSearchModel.Email) &&
                                          (!userSearchModel.IsDeleted.HasValue || w.IsDeleted == userSearchModel.IsDeleted || (userSearchModel.IsDeleted == false && w.IsDeleted != true))
                                          //Excluding users without Email address (API Accounts)
                                          && !string.IsNullOrEmpty(w.Email))
                                   .OrderByDescending(o => o.CreationDate)
                                   .Skip(userSearchModel.PageIndex * config.Value.PageSize).Take(config.Value.PageSize)
                                   .ToListAsync();
            }
            else
            {
                var tmpUsers = await userManager.GetUsersInRoleAsync(userSearchModel.RoleName);

                count = tmpUsers
                        .Where(w => (string.IsNullOrEmpty(userSearchModel.FullName) || w.FullName.Contains(userSearchModel.FullName)) &&
                               (string.IsNullOrEmpty(userSearchModel.Email) || w.Email == userSearchModel.Email) &&
                               (!userSearchModel.IsDeleted.HasValue || w.IsDeleted == userSearchModel.IsDeleted ||
                                (userSearchModel.IsDeleted == false && w.IsDeleted != true)))
                        .Count();

                applicationUsers = tmpUsers
                                   .Where(w => (string.IsNullOrEmpty(userSearchModel.FullName) || w.FullName.Contains(userSearchModel.FullName)) &&
                                          (string.IsNullOrEmpty(userSearchModel.Email) || w.Email == userSearchModel.Email) &&
                                          (!userSearchModel.IsDeleted.HasValue || w.IsDeleted == userSearchModel.IsDeleted ||
                                           (userSearchModel.IsDeleted == false && w.IsDeleted != true)))
                                   .OrderByDescending(o => o.CreationDate)
                                   .Skip(userSearchModel.PageIndex * config.Value.PageSize).Take(config.Value.PageSize).ToList();
            }

            users.PagingModel = commonFunctions.PreparePagingModel(userSearchModel.PageIndex, count);
            users.ListObj     = applicationUsers;

            return(users);
        }
Exemplo n.º 23
0
 public async Task <IActionResult> Index(PagedListModel <CustomerListModel> pagedListModel)
 {
     try
     {
         var customerList = iCustomer.GetAllCustomer(0, "", "", pagedListModel.Page, pagedListModel.Limit, Constants.DefaultIsDelete, Constants.DefaultIsStatus, pagedListModel.Search);
         return(View(customerList));
     }
     catch (Exception ex)
     {
         LogHelper.ExceptionLog(ex.Message + Constants.ExceptionSeprator + ex.StackTrace);
         throw ex;
     }
 }
Exemplo n.º 24
0
        public static PagedListModel <T> GetPage(IPagedList <T> list, int currentPage, int itemPerPage)
        {
            var PagedList = new PagedListModel <T>
            {
                Data      = list,
                PageIndex = currentPage,
                PageSize  = itemPerPage,
                TotalPage = list.PageCount,
                TotalItem = list.TotalItemCount,
            };

            return(PagedList);
        }
Exemplo n.º 25
0
        private ActionResult Index(Expression <Func <Profile, bool> > controllerFilter, int?page = 1)
        {
            var pageIndex = (page ?? 1);
            int total;
            var profiles             = _profileService.GetNewProfiles(controllerFilter, out total, pageIndex, PageSize);
            var profilesModel        = Mapper.Map <IList <ProfileModel> >(profiles);
            var profilesAsIPagedList = new StaticPagedList <ProfileModel>(profilesModel, pageIndex, PageSize, total);
            var model = new PagedListModel <ProfileModel> {
                List = profilesAsIPagedList, Total = total
            };

            return(View("Index", model));
        }
Exemplo n.º 26
0
        public void JsonTest()
        {
            var model = new PagedListModel <int>()
            {
                PageNumber = 1,
                PageSize   = 3,
                TotalCount = 10,
                Data       = new[] { 1, 2, 3 }
            };
            var json   = model.ToJson();
            var dModel = json.JsonToObject <PagedListModel <int> >();

            Assert.Equal(model.PageSize, dModel.PageSize);
        }
Exemplo n.º 27
0
        public ActionResult New(int?key)
        {
            var pageIndex = (key ?? 1);
            int total;
            var newProfiles = KatushaProfile.Gender == (byte)Sex.Male
                    ? ProfileService.GetNewProfiles(p => p.Gender == (byte)Sex.Female, out total, pageIndex, PageSize)
                    : ProfileService.GetNewProfiles(p => p.Gender == (byte)Sex.Male, out total, pageIndex, PageSize);

            var profilesModel        = Mapper.Map <IEnumerable <ProfileModel> >(newProfiles);
            var profilesAsIPagedList = new StaticPagedList <ProfileModel>(profilesModel, pageIndex, PageSize, total);
            var model = new PagedListModel <ProfileModel> {
                List = profilesAsIPagedList, Total = total
            };

            return(View(model));
        }
Exemplo n.º 28
0
        public ActionResult MyVisits(int?key)
        {
            var pageIndex = (key ?? 1);
            int total;

            var visitors = _visitService.GetMyVisits(KatushaProfile.Id, out total, pageIndex, PageSize);

            var visitorsModel = Mapper.Map <IList <NewVisitModel> >(visitors);

            var visitorAsIPagedList = new StaticPagedList <NewVisitModel>(visitorsModel, pageIndex, PageSize, total);
            var model = new PagedListModel <NewVisitModel> {
                List = visitorAsIPagedList, Total = total
            };

            return(View(model));
        }
        public ActionResult Products(int?page, int?items)
        {
            ProductListModel list = new ProductListModel
            {
                Products = _productProvider.GetAllProducts().Select(entity => ProductMapper.ToModel(entity))
            };

            int pageNumber = page ?? 1;
            int pageSize   = items ?? list.Products.Count();

            PagedListModel pagedList = new PagedListModel
            {
                Products = list.Products.ToPagedList(pageNumber, pageSize)
            };

            return(View(pagedList));
        }
Exemplo n.º 30
0
        protected override IActionResult RenderIndex(PagedListModel <RoleReadModel, RoleFilteredPagedQueryModel> model)
        {
            var indexModel = new RoleIndexViewModel
            {
                PagedList   = model,
                Permissions = _permissionService
                              .ReadList()
                              .Select(p => new LookupItem {
                    Value = p.Name, Text = p.DisplayName.Localize(_localizerFactory)
                })
                              .ToList()
            };

            return(Request.IsAjaxRequest()
                ? (IActionResult)PartialView(indexModel)
                : View(indexModel));
        }
Exemplo n.º 31
0
 public ActionResult Index(int? key)
 {
     var pageIndex = (key ?? 1);
     int total;
     IEnumerable<Domain.Entities.Profile> profiles;
     if (KatushaProfile == null) {
         profiles = ProfileService.GetNewProfiles(p => p.ProfilePhotoGuid != Guid.Empty, out total, pageIndex, DependencyConfig.GlobalPageSize);
     } else {
         if(KatushaProfile.Gender == (byte) Sex.Female) {
             profiles = ProfileService.GetNewProfiles(p => p.Gender == (byte)Sex.Male, out total, pageIndex, DependencyConfig.GlobalPageSize);
         } else {
             profiles = ProfileService.GetNewProfiles(p => p.Gender == (byte)Sex.Female, out total, pageIndex, DependencyConfig.GlobalPageSize);
         }
     }
     var profilesModel = Mapper.Map<IEnumerable<ProfileModel>>(profiles);
     var profilesAsIPagedList = new StaticPagedList<ProfileModel>(profilesModel, pageIndex, DependencyConfig.GlobalPageSize, total);
     var model = new PagedListModel<ProfileModel> { List = profilesAsIPagedList, Total = total};
     return View(model);
 }
Exemplo n.º 32
0
        public ActionResult Online(int? key) {
            var pageIndex = (key ?? 1);
            int total;
            var sex = (KatushaProfile.Gender == (byte) Sex.Female) ? (byte) Sex.Male : (byte) Sex.Female;
            IEnumerable<State> onlineStates = StateService.OnlineProfiles(sex, out total, pageIndex, PageSize).ToList();
            var onlineProfiles = new List<Profile>(PageSize);
            onlineProfiles.AddRange(onlineStates.Select(state => ProfileService.GetProfile(state.ProfileId)));

            var profilesModel = Mapper.Map<IEnumerable<ProfileModel>>(onlineProfiles);
            var profilesAsIPagedList = new StaticPagedList<ProfileModel>(profilesModel, pageIndex, PageSize, total);
            var model = new PagedListModel<ProfileModel> { List = profilesAsIPagedList, Total = total };
            return View(model);
        }
Exemplo n.º 33
0
 private ActionResult Index(Expression<Func<Profile, bool>> controllerFilter, int? page = 1)
 {
     var pageIndex = (page ?? 1);
     int total;
     var profiles = _profileService.GetNewProfiles(controllerFilter, out total, pageIndex, PageSize);
     var profilesModel = Mapper.Map<IList<ProfileModel>>(profiles);
     var profilesAsIPagedList = new StaticPagedList<ProfileModel>(profilesModel, pageIndex, PageSize, total);
     var model = new PagedListModel<ProfileModel> { List = profilesAsIPagedList, Total = total };
     return View("Index", model);
 }
Exemplo n.º 34
0
        public ActionResult New(int? key)
        {
            var pageIndex = (key ?? 1);
            int total;
            var newProfiles = KatushaProfile.Gender == (byte)Sex.Male
                    ? ProfileService.GetNewProfiles(p => p.Gender == (byte)Sex.Female, out total, pageIndex, PageSize)
                    : ProfileService.GetNewProfiles(p => p.Gender == (byte)Sex.Male, out total, pageIndex, PageSize);

            var profilesModel = Mapper.Map<IEnumerable<ProfileModel>>(newProfiles);
            var profilesAsIPagedList = new StaticPagedList<ProfileModel>(profilesModel, pageIndex, PageSize, total);
            var model = new PagedListModel<ProfileModel> { List = profilesAsIPagedList, Total = total };
            return View(model);
        }
Exemplo n.º 35
0
 public ActionResult Photos(string key)
 {
     int total;
     int pageNo;
     if (!int.TryParse(key, out pageNo)) pageNo = 1;
     var list = _photosService.AllPhotos(out total, "0-", pageNo, DependencyConfig.GlobalPageSize);
     var pagedList = new StaticPagedList<Guid>(list, pageNo, DependencyConfig.GlobalPageSize, total);
     var photoGuids = new PagedListModel<Guid> { List = pagedList, Total = total };
     var dictionaryPhotos = new Dictionary<Guid, PhotoModel>();
     var dictionaryProfiles = new Dictionary<Guid, ProfileModel>();
     foreach (var guid in list) {
         var photo = _photosService.GetByGuid(guid);
         if (photo != null) {
             dictionaryPhotos.Add(guid, Mapper.Map<PhotoModel>(photo));
             dictionaryProfiles.Add(guid, Mapper.Map<ProfileModel>(ProfileService.GetProfile(photo.ProfileId)));
         }
     }
     var model = new UtilitiesPhotosModel { PhotoGuids = photoGuids, Photos = dictionaryPhotos, Profiles = dictionaryProfiles };
     return View(model);
 }