Exemplo n.º 1
0
        /// <summary>
        /// Danh sách sản phẩm gợi ý.
        /// </summary>
        /// <param name="withOutId"></param>
        /// <param name="cityId"></param>
        /// <param name="districtId"></param>
        /// <returns></returns>
        public ActionResult Template1ProductSuggest(int withOutId, int cityId, int districtId)
        {
            Entities.ProductCondtions condition = new Entities.ProductCondtions();
            condition.withOutId = withOutId;
            condition.City      = cityId;
            condition.District  = districtId;
            condition.Page      = 1;
            condition.Limit     = 20;
            var listProduct = productService.List(condition);

            ViewBag.ListProduct = listProduct;
            ViewBag.BoxTitle    = "Danh sách nhà gợi ý";
            return(PartialView("_ListItem"));
        }
Exemplo n.º 2
0
        public ActionResult Index(Template1SearchModel model)
        {
            GetDataModel(model);

            // Get Tab ID
            int tabId = 0;

            switch (model.TransactionType)
            {
            case 0:
                tabId = 0;
                break;

            case 1:
                tabId = 1;
                break;

            case 2:
                tabId = 2;
                break;

            case 3:
                break;

            default:
                tabId = 0;
                break;
            }
            Entities.ProductCondtions e = new Entities.ProductCondtions();
            model.Mapping(model, ref e);
            var lstTemp = productService.List(e);

            // Lấy danh sách Product Follow
            int loginUser = 0;

            int.TryParse(CookieHelper.Get(AdminConfigs.COOKIES_USER_ID), out loginUser);
            if (loginUser > 0)
            {
                var productFollows = productService.ListProductFollowId(loginUser);
                if (productFollows != null && productFollows.Count > 0)
                {
                    foreach (var item in productFollows)
                    {
                        lstTemp.Where(x => x.Id == item.ProductId).Select(y => { y.IsFollow = item.IsFollow; return(y); }).ToList();
                    }
                }
            }

            int totalRecord = 0;

            if (lstTemp.Count > 0)
            {
                totalRecord = lstTemp[0].Total.Value;
                Paging(model.Page, totalRecord, model.PageSize);
            }

            ViewBag.BoxTitle    = "Danh sách nhà";
            ViewBag.ListProduct = lstTemp;
            ViewBag.TabID       = tabId;

            return(View(model));
        }