public ActionResult Pages(int?page) { int pageSize = 10; int pageIndex = (page ?? 1); List <astwod_Page> allpages = repository.GetAll().ToList(); List <PageModel> pages = new List <PageModel>(); foreach (var item in allpages) { if (item.IsRemove != true) { pages.Add(item); } } return(View(pages.ToPagedList(pageIndex, pageSize))); }
public ActionResult AdminIndex() { // Mapper.Initialize(cfg => cfg.CreateMap<Pages, Pyramid.Entity.Page>()); // var model = _pageRepo.GetAll().ToList(); var model = _pageRepo.GetAll(); return(View(model)); }
public void WhenGetAllFromEmptyDatabase_ThenReturnsEmptyCollection() { var repository = new PageRepository(new DatabaseFactory()); IEnumerable<Page> actual = repository.GetAll(); Assert.NotNull(actual); var actualList = new List<Page>(actual); Assert.Equal(0, actualList.Count); }
public void Should_return_all_pages() { using (var context = new WeapsyDbContext(_contextOptions)) { var repository = new PageRepository(Shared.CreateNewContextFactory(context), Shared.CreateNewMapper()); var pages = repository.GetAll(_siteId); Assert.AreEqual(2, pages.Count); } }
static void CleanDataBase() { var chaptersIds = chapterRepository.GetAll().Select(c => c.Id); var pageTodelete = pageRepository.GetAll().Where(p => !chaptersIds.Contains(p.ChapterId)); foreach (var item in pageTodelete) { pageRepository.Delete(item); } }
public void Should_return_all_pages_with_no_deleted_page_modules() { using (var context = new WeapsyDbContext(_contextOptions)) { var repository = new PageRepository(Shared.CreateNewContextFactory(context), Shared.CreateNewMapper()); var pages = repository.GetAll(_siteId); foreach (var page in pages) { Assert.AreEqual(0, page.PageModules.Count(x => x.Status == PageModuleStatus.Deleted)); } } }
public XmlSitemapResult Index() { var items = new List <ISiteMapItem>(); var pages = repository.GetAll(); foreach (var page in pages) { items.Add(new SiteMapItem(System.Web.HttpContext.Current.Request.Url.Authority + "/" + page.LabelForURL) { Priority = 1 }); } return(new XmlSitemapResult(items)); }
static void Main(string[] args) { var redisUri = ConfigurationManager.AppSettings["Redis_Server_Uri"]; IRedisClientsManager clientManger = new PooledRedisClientManager(redisUri); PageRepository pageRepository = new PageRepository(clientManger.GetClient()); // bin\windows\zookeeper-server-start.bat config\zookeeper.properties // bin\windows\kafka-server-start.bat config\server.properties // bin\windows\kafka-console-consumer.bat --zookeeper localhost:2181 --topic PageLoadTime --from-beginning // kafka-console-producer.bat --broker-list localhost:9092 --topic PageLoadTime //// CONSUMER READING OFF THE QUEUE //var options = new KafkaOptions(new Uri("http://localhost:9092")); //var router = new BrokerRouter(options); //var redisClient = new RedisClient("127.0.0.1:6379"); //var db = redisClient.Instance(1); //var consumer = new Consumer(new ConsumerOptions("PageLoadTime", router)); //var allData = consumer.Consume(); //Task.Factory.StartNew(() => // { // int i = 0; // foreach (var data in allData) // { // if (string.IsNullOrEmpty(data.Key)) // { // continue; // } // Console.ForegroundColor = ConsoleColor.Green; // Console.WriteLine(string.Format("Reading {0} message => {1}", i, data.Value)); // Console.ForegroundColor = ConsoleColor.Yellow; // Console.WriteLine("----------------------------------------------------------"); // db.StringSetAsync(data.Key, data.Value.ToString(CultureInfo.InvariantCulture)); // i++; // } // }); var redisData = pageRepository.GetAll(); DisplayAll(redisData); // CONSUMER READING OFF THE QUEUE + REDIS var clientSettings = new MessageBusClient(); var router = clientSettings.GetClientRouter(); var consumer = new JsonConsumer <PageModel>(new ConsumerOptions("PageLoadTime", router)); var allData = consumer.Consume(); Task.Factory.StartNew(() => { foreach (var data in allData) { if (string.IsNullOrEmpty(data.Value.Key)) { continue; } var page = pageRepository.Store(data.Value); DisplaySingle(page); } }); Console.ReadKey(); }
static void Main(string[] args) { var redisUri = ConfigurationManager.AppSettings["Redis_Server_Uri"]; IRedisClientsManager clientManger = new PooledRedisClientManager(redisUri); PageRepository pageRepository = new PageRepository(clientManger.GetClient()); // bin\windows\zookeeper-server-start.bat config\zookeeper.properties // bin\windows\kafka-server-start.bat config\server.properties // bin\windows\kafka-console-consumer.bat --zookeeper localhost:2181 --topic PageLoadTime --from-beginning // kafka-console-producer.bat --broker-list localhost:9092 --topic PageLoadTime //// CONSUMER READING OFF THE QUEUE //var options = new KafkaOptions(new Uri("http://localhost:9092")); //var router = new BrokerRouter(options); //var redisClient = new RedisClient("127.0.0.1:6379"); //var db = redisClient.Instance(1); //var consumer = new Consumer(new ConsumerOptions("PageLoadTime", router)); //var allData = consumer.Consume(); //Task.Factory.StartNew(() => // { // int i = 0; // foreach (var data in allData) // { // if (string.IsNullOrEmpty(data.Key)) // { // continue; // } // Console.ForegroundColor = ConsoleColor.Green; // Console.WriteLine(string.Format("Reading {0} message => {1}", i, data.Value)); // Console.ForegroundColor = ConsoleColor.Yellow; // Console.WriteLine("----------------------------------------------------------"); // db.StringSetAsync(data.Key, data.Value.ToString(CultureInfo.InvariantCulture)); // i++; // } // }); var redisData = pageRepository.GetAll(); DisplayAll(redisData); // CONSUMER READING OFF THE QUEUE + REDIS var clientSettings = new MessageBusClient(); var router = clientSettings.GetClientRouter(); var consumer = new JsonConsumer<PageModel>(new ConsumerOptions("PageLoadTime", router)); var allData = consumer.Consume(); Task.Factory.StartNew(() => { foreach (var data in allData) { if (string.IsNullOrEmpty(data.Value.Key)) { continue; } var page = pageRepository.Store(data.Value); DisplaySingle(page); } }); Console.ReadKey(); }
public IQueryable <Page> GetAll() { return(_pageRepository.GetAll()); }
public ActionResult GetAll_() { return(Ok(_mapper.Map <IEnumerable <PageViewModel> >(_pageRepository.GetAll()))); }