コード例 #1
0
        public ActionResult Cat(int?price, string name = null) //根据条件筛选符合条件的猫咪
        {
            var cats     = catManager.Cats(price, name);       //筛选条件放到DAL层中
            var catIndex = new catIndexViewModel();

            catIndex.AllCats = cats;
            return(PartialView(catIndex));
        }
コード例 #2
0
        public ActionResult Cat(int page = 1)//展示猫咪的分布视图
        {
            var cats     = catManager.getCat();
            var catIndex = new catIndexViewModel()
            {
                AllCats = cats,
            };

            return(PartialView(catIndex));
        }
コード例 #3
0
        //private CatpuziEntities db = new CatpuziEntities();

        public ActionResult CatIndex()            //筛选猫咪的主页
        {
            var className = catManager.getName(); //获取所有类型名称
            var catIndex  = new catIndexViewModel()
            {
                CatName = className
            };

            return(View(catIndex));
        }
コード例 #4
0
        public ActionResult CatDetails(int id)                                //猫咪细节
        {
            var data = catManager.getCatByID(id);                             //通过ID获取猫咪
            var shop = catManager.Shop(Convert.ToInt32(data.shop_id));        //通过猫咪id获取所在店铺
            var user = catManager.User(Convert.ToInt32(shop.user_id));        //通过店铺id获取店主(用户)
            var cat  = catManager.getByShopId(Convert.ToInt32(shop.shop_id)); //通过店铺ID获取该店中的10只猫咪

            catIndexViewModel catIndex = new catIndexViewModel();

            catIndex.ByID     = data; //通过ID获取猫咪
            catIndex.ByCatID  = shop; //通过猫咪id获取所在店铺
            catIndex.ByShopID = user; //通过店铺id获取店主(用户)
            catIndex.BySId    = cat;  //通过店铺ID获取该店中的10只猫咪
            return(View(catIndex));
        }