Exemple #1
0
        public async Task <GetAllDataOutput> GetAllDataAsync(GetAllDataInput input)
        {
            var res = new GetAllDataOutput();


            var v = _productRepo.GetAll().Select(p => p);

            int count = v.Count();

            if (input.SearchTerm.IsNullOrEmpty() == false)
            {
                v = v.Where(p => p.Name.Contains(input.SearchTerm));
            }

            int resultCount = v.Count();

            v = v.Skip(input.PI.PageNumber * 10).Take(10);

            var d = v.ToList();


            res.Data = d.Select(p => new ProductDto()
            {
                Id                = p.Id,
                CreationTime      = p.CreationTime.ToString(),
                Description       = p.Description,
                Name              = p.Name,
                EnDescription     = p.EnDescription,
                EnName            = p.EnName,
                SendPriceInRange  = p.SendPriceInRange,
                SendPriceOutRange = p.SendPriceOutRange,
                Count             = p.Count,
                Labels            = p.Labels,
                Price             = p.Price,
                ProductCategoryId = p.ProductCategoryId,
                Unit              = p.Unit,
                Weight            = p.Weight
            }).ToList();


            res.PO = new PagingOutput()
            {
                CurrentPage = input.PI.PageNumber,
                PageSize    = 10,
                ResultCount = resultCount,
                TotalCount  = count
            };


            return(res);
        }
Exemple #2
0
        public async Task <GetAllDataOutput> GetAllDataAsync(GetAllDataInput input)
        {
            var res = new GetAllDataOutput();


            var v = _contactUsRepo.GetAll().Select(p => p);

            int count = v.Count();

            if (input.SearchTerm.IsNullOrEmpty() == false)
            {
                v = v.Where(p => p.Name.Contains(input.SearchTerm));
            }

            int resultCount = v.Count();

            v = v.Skip(input.PI.PageNumber * 10).Take(10);

            var d = v.ToList();


            res.Data = d.Select(p => new ContactUsDto()
            {
                Description = p.Description,
                Email       = p.Email,
                Family      = p.Family,
                Id          = p.Id,
                IsSeen      = p.IsSeen,
                Name        = p.Name,
                Subject     = p.Subject,
                Type        = p.Type,
            }).ToList();


            res.PO = new PagingOutput()
            {
                CurrentPage = input.PI.PageNumber,
                PageSize    = 10,
                ResultCount = resultCount,
                TotalCount  = count
            };


            return(res);
        }
        public async Task <GetAllDataOutput> GetAllDataAsync(GetAllDataInput input)
        {
            var res = new GetAllDataOutput();


            var v = _blogRepo.GetAll().Select(p => p);

            int count = v.Count();

            if (input.SearchTerm.IsNullOrEmpty() == false)
            {
                v = v.Where(p => p.Title.Contains(input.SearchTerm));
            }

            int resultCount = v.Count();

            v = v.Skip(input.PI.PageNumber * 10).Take(10);

            var d = v.ToList();


            res.Data = d.Select(p => new BlogDto()
            {
                Title         = p.Title,
                Id            = p.Id,
                CreationTime  = p.CreationTime.ToString(),
                Description   = p.Description,
                EnDescription = p.EnDescription,
                EnTitle       = p.EnTitle,
                Labels        = p.Labels
            }).ToList();


            res.PO = new PagingOutput()
            {
                CurrentPage = input.PI.PageNumber,
                PageSize    = 10,
                ResultCount = resultCount,
                TotalCount  = count
            };


            return(res);
        }