Esempio n. 1
0
        public ActionResult GetIndexArticles(int id)
        {
            var articlesEF = from a in db.Articles
                             where a.State && !a.SoldState
                             select a;

            var articles = articlesEF.ToList().OrderBy(a => a.CreationDate).ToList();;
            List <ArticleViewModel> ArticleViewModelList        = new List <ArticleViewModel>();
            List <ArticleViewModel> ArticleViewModelPartialList = new List <ArticleViewModel>();

            foreach (var article in articles)
            {
                ArticleViewModel articleViewModel = GetArticleViewModel(article);
                ArticleViewModelList.Add(articleViewModel);
            }

            switch (id)
            {
            case 1:
                var ListOutstandingEF = from a in ArticleViewModelList
                                        where a.Article.ArticleKind == EArticleKind.Sobresaliente
                                        select a;
                List <ArticleViewModel> articleViewModelsOrderedList = ListOutstandingEF.ToList();
                ArticleViewModelPartialList = articleViewModelsOrderedList.OrderByDescending(a => a.Article.CreationDate).ToList();
                break;

            case 2:
                List <ArticleViewModel> ArticleViewModelCutList = new List <ArticleViewModel>();

                var i = 0;
                foreach (var article in ArticleViewModelList)
                {
                    if (i <= 8 && article.Article.ArticleKind == EArticleKind.Venta)
                    {
                        ArticleViewModelCutList.Add(article);
                        i++;
                    }
                }
                ArticleViewModelPartialList = ArticleViewModelCutList;
                break;

            case 3:
                var ListOportunityEF = from a in ArticleViewModelList
                                       where a.Article.ArticleKind == EArticleKind.Oportunidad
                                       select a;
                ArticleViewModelPartialList = ListOportunityEF.ToList();
                break;
            }


            LandingView landingView = new LandingView()
            {
                ArticleViewModels = ArticleViewModelPartialList
            };

            return(PartialView("IndexArticleList", landingView));
        }
Esempio n. 2
0
        public ActionResult Index()
        {
            ApprovesBadge();
            var articlesEF = from a in db.Articles
                             where a.State && !a.SoldState
                             select a;

            var articles = articlesEF.ToList();



            List <ArticleViewModel> ArticleViewModelList = GetArticleViewModelList(articles);
            var individualContributors = db.IndividualContributors.ToList().OrderBy(x => x.Name).ToList();
            IQueryable <UbicationPicture> OutstandingPictures = from p in db.UbicationPictures
                                                                where p.OutstandingPicture == true && p.Extension != null
                                                                select p;

            ViewBag.UbicationPicture = OutstandingPictures.ToList();
            var ubicationList = from u in db.Ubications
                                where u.UbicationCategory.Name == "Condominio"
                                select u;

            ViewBag.Ubications        = ubicationList.ToList();
            ViewBag.UbicationCategory = new SelectList(db.UbicationCategory, "UbicationCategoryId", "Name");


            var ArticleViewModelListOrder = ArticleViewModelList.OrderByDescending(a => a.Article.CreationDate).ToList();

            List <ArticleViewModel> ArticleViewModelCutList = new List <ArticleViewModel>();

            var i = 0;

            foreach (var article in ArticleViewModelListOrder)
            {
                if (i <= 8 && article.Article.ArticleKind == EArticleKind.Venta)
                {
                    ArticleViewModelCutList.Add(article);
                    i++;
                }
            }



            LandingView landingView = new LandingView
            {
                ArticleViewModels      = ArticleViewModelCutList,
                IndividualContributors = individualContributors
            };


            return(View(landingView));
        }
Esempio n. 3
0
        private void BackClicked(object sender, EventArgs e)
        {
            LandingView landingView = new LandingView();

            Application.Current.MainPage = landingView;
        }