Пример #1
0
        public void Service_Then_Can_GetAdvertisements()
        {
            // ARRANGE

            // ACT
            var entities = _service.GetAdvertisements();

            // ASSERT
            Assert.IsTrue(entities.Any());
        }
Пример #2
0
        // GET: Advertisements
        public IActionResult Index(string titleFIlter)
        {
            //var advertisements = await _processor.GetAdvertisements<List<Advertisement>>();
            var advertisements = advertService.GetAdvertisements();

            if (!string.IsNullOrEmpty(titleFIlter))
            {
                advertisements = advertisements.Where(x => x.Title.Contains(titleFIlter)).ToList();
            }

            return(View(advertisements));
        }
Пример #3
0
        public IActionResult Index(int?pageNo, int?recordSize)
        {
            recordSize = recordSize.HasValue ? recordSize.Value : 10;


            ShopProductViewModel vm = new ShopProductViewModel()
            {
                Products       = _productService.ListProduct(pageNo, recordSize.Value, out int count),
                Categories     = _categoryService.GetCategories(),
                Advertisements = _advertisementService.GetAdvertisements(),
                PageSize       = recordSize.Value,
                PageNo         = pageNo,
                Blogs          = _blogService.GetAllProducts()
            };

            vm.Pager = new Pager(count, pageNo, recordSize.Value);

            return(View(vm));
        }
Пример #4
0
 public IEnumerable<Advertisement> GetAdvertisements()
 {            
     return _service.GetAdvertisements();
 }