Exemple #1
0
        public ActionResult Index()
        {
            if (MembershipHelper.CurrentCity == null || MembershipHelper.CurrentCity.IDCategory == 0)
            {
                tCategory cat = _categoryRepository.GetListByIDCategoryType((int)Enums.enmCategoryTypes.City).
                                FirstOrDefault();

                if (cat == null)
                {
                    cat = new tCategory()
                    {
                        Name = "City Not Found", IDCategory = 0
                    }
                }
                ;
                MembershipHelper.CurrentCity = cat;
            }
            tDeal currentDeal = _dealRepository.GetLatestDeal(MembershipHelper.CurrentCity.IDCategory);

            ViewBag.LeftTSStr = tDealUtils.GetLeftTSStrForDeal(currentDeal);
            if (currentDeal == null)
            {
                currentDeal = new tDeal();
            }
            if (MembershipHelper.CurrentCity != null && currentDeal != null)
            {
                ViewBag.DealsBySameCategory = _dealRepository.GetListByIDCategory(currentDeal.IDDealCategory).Take(6).OrderByDescending(t => t.DateAdded).ToList();
            }
            else
            {
                ViewBag.DealsBySameCategory = new List <tDeal>();
            }
            return(View(currentDeal));
        }