Esempio n. 1
0
        public IActionResult AddRelations(int id)
        {
            var related = _related.GetAll().Where(r => r.Page1Id == id || r.Page2Id == id).Select(r => r.Page1Id == id ? r.Page2Id : r.Page1Id).ToList();

            var res = _repo.GetAll()
                      .Where(r => r.PageId != id)
                      .Select(r => new RelPagesView()
            {
                RelPageId  = r.PageId,
                IsSelected = related.Contains(r.PageId),
                Name       = r.UrlName
            })
                      .ToList();

            return(View(res));
        }
Esempio n. 2
0
        // GET: RelatedPages
        public IActionResult Index(string prop = "id", bool order = true, int take = 5, int skip = 0)
        {
            ViewBag.Take = 5;

            ViewBag.Order = !order;
            var query = _context.GetAll();

            ViewBag.Count = query.Count();
            var res = Utils.Sort <RelatedPages>(query, Utils.GetKeyForRelPages(prop), order)
                      .TakeSkip(take, skip).ToList();

            return(View(res));
        }
Esempio n. 3
0
 private Task <List <Page> > GetItemsAsync(int pageID)
 {
     return(Task <List <Page> > .Run(() => db.GetAll().Where(r => r.Page1Id == pageID || r.Page2Id == pageID).Select(r => r.Page1Id == pageID?r.Page2:r.Page1).ToList()));
 }