コード例 #1
0
        public ActionResult StorePicker()
        {
            var stores = _storeClient.GetStores();

            if (stores.Any())
            {
                var model = new StoresModel
                {
                    Stores = (from store in stores
                              where IsStoreVisible(store)
                              select new StoreModel
                    {
                        Id = store.StoreId,
                        Name = store.Name,
                        Url = String.IsNullOrEmpty(store.Url)
                                      ? Url.RouteUrl("Store", new { store = store.StoreId })
                                      : store.Url
                    }).ToArray(),
                    SelectedStore     = UserHelper.CustomerSession.StoreId,
                    SelectedStoreName = UserHelper.CustomerSession.StoreName
                };

                return(model.Stores.Any() ? PartialView("StorePicker", model) : null);
            }
            return(null);
        }
コード例 #2
0
ファイル: StoresAccess.cs プロジェクト: cedar-s/pinpaida
        /// <summary>
        /// 获取店铺详情
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static StoresModel GetStoresDetail(int id)
        {
            var           sm  = new StoresModel();
            StringBuilder sql = new StringBuilder();

            sql.AppendFormat(@"SELECT * FROM stores s where s.Id={0}", id);
            DataTable dt   = MySqlHelper.Query(sql.ToString())?.Tables[0];
            var       list = GetStoresModelList(dt);

            if (list != null && list.Count > 0)
            {
                sm = list[0];
            }
            return(sm);
        }