コード例 #1
0
ファイル: GoodsController.cs プロジェクト: MINDOU520/NB-NB
        // GET: Goods
        public ActionResult Index(string searchString)
        {
            var goods           = goodsManager.GetAllGoods();
            var goodsbasketball = goodsManager.Getbasketball();
            var goodsclothes    = goodsManager.Getclothes();
            var goodsshose      = goodsManager.Getshose();
            var goodsprotective = goodsManager.Getprotective();
            var goodsother      = goodsManager.Getother();

            if (!String.IsNullOrEmpty(searchString))
            {
                goods = goods.Where(s => s.GName.Contains(searchString));
            }

            var index = new App.Models.GoodsViewModel
            {
                Goods1     = goods,
                Basketball = goodsbasketball,
                Clothes    = goodsclothes,
                Shose      = goodsshose,
                Protective = goodsprotective,
                Other      = goodsother
            };

            return(View(index));
        }
コード例 #2
0
        public async Task <BaseRequestResponse <List <GoodsDTO> > > GetAsync()
        {
            //TODO 调用业务层获取数据库数据
            //此处直接手动写一些数据返回了
            IGoodsManager   goodsManager = new GoodsManager();
            List <GoodsDTO> list         = await goodsManager.GetAllGoods();

            BaseRequestResponse <List <GoodsDTO> > response
                = new BaseRequestResponse <List <GoodsDTO> >
                {
                Code    = ResultCode.NormalCode,
                Result  = list,
                Message = "获取成功"
                };

            return(response);
        }
コード例 #3
0
        // GET: GoodsMAnager
        public ActionResult Index(string searchString)
        {
            if (Session["MGID"] != null)
            {
                var goods = goodsManager.GetAllGoods();

                if (!String.IsNullOrEmpty(searchString))
                {
                    goods = goods.Where(s => s.GName.Contains(searchString));
                }

                return(View(db.Goods.ToList()));
            }
            else
            {
                return(RedirectToAction("ManagerLogin", "Manager"));
            }
        }
コード例 #4
0
        static void Main(string[] args)
        {
            string          path         = ConfigurationManager.AppSettings["path"].ToString();
            GoodsManager    goodsManager = new GoodsManager();
            List <GoodInfo> list         = goodsManager.GetAllGoods();

            if (!string.IsNullOrWhiteSpace(path) && Directory.Exists(path))
            {
                list.ForEach(x =>
                {
                    string imgPath = path + x.pic1;
                    if (!File.Exists(imgPath))
                    {
                        WriteFile(x);
                    }
                });
            }
        }