// GET: Position/Create
        public async Task<ActionResult> Create()
        {
            IEnumerable<Store> stores = null;
            using (var client = new StoreSvcClient())
            {
                stores = await client.GetStores();
            }

            var storeTitleList = new List<string>();
            var storeTitlesQuery = from s in stores select s.StoreName;

            storeTitleList.AddRange(storeTitlesQuery);
            var storeSelectList = new SelectList(storeTitleList);

            ViewBag.StoreTitles = storeSelectList;
            ViewBag.Stores = stores;

            IEnumerable<Test> tests = null;
            using (var client = new TestSvcClient())
            {
                tests = await client.GetTests();
            }

            var testQuestionList = new List<string>();
            var testTitlesQuery = from t in tests select t.TestName;

            testQuestionList.AddRange(testTitlesQuery);
            var testSelectList = new SelectList(testQuestionList);

            ViewBag.TestQuestionList = testSelectList;
            ViewBag.Tests = tests;

            return View();
        }
Пример #2
0
        static void Main(string[] args)
        {
            TestSvcClient proxy = new TestSvcClient();

            for (int i = 0; i < 4; i++)
            {
                Console.WriteLine("{0}: 开始调用服务方法", DateTime.Now.Ticks);
                proxy.BeginGetData(GetFruitNameCallBack, proxy);
            }

            Console.ReadLine();
        }
Пример #3
0
        // GET: Position/Edit/5
        public async Task <ActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Position position = await _client.GetPositionById(id);

            IEnumerable <Store> stores = null;

            using (var client = new StoreSvcClient())
            {
                stores = await client.GetStores();
            }

            var storeTitleList   = new List <string>();
            var storeTitlesQuery = from s in stores select s.StoreName;

            storeTitleList.AddRange(storeTitlesQuery);
            var storeSelectList = new SelectList(storeTitleList);

            ViewBag.StoreTitles = storeSelectList;
            ViewBag.Stores      = stores;

            IEnumerable <Test> tests = null;

            using (var client = new TestSvcClient())
            {
                tests = await client.GetTests();
            }

            var testQuestionList = new List <string>();
            var testTitlesQuery  = from t in tests select t.TestName;

            testQuestionList.AddRange(testTitlesQuery);
            var testSelectList = new SelectList(testQuestionList);

            ViewBag.TestQuestionList = testSelectList;
            ViewBag.Tests            = tests;

            if (position == null)
            {
                return(HttpNotFound());
            }
            return(View(position));
        }
Пример #4
0
        // GET: Position/Create
        public async Task <ActionResult> Create()
        {
            IEnumerable <Store> stores = null;

            using (var client = new StoreSvcClient())
            {
                stores = await client.GetStores();
            }

            var storeTitleList   = new List <string>();
            var storeTitlesQuery = from s in stores select s.StoreName;

            storeTitleList.AddRange(storeTitlesQuery);
            var storeSelectList = new SelectList(storeTitleList);

            ViewBag.StoreTitles = storeSelectList;
            ViewBag.Stores      = stores;

            IEnumerable <Test> tests = null;

            using (var client = new TestSvcClient())
            {
                tests = await client.GetTests();
            }

            var testQuestionList = new List <string>();
            var testTitlesQuery  = from t in tests select t.TestName;

            testQuestionList.AddRange(testTitlesQuery);
            var testSelectList = new SelectList(testQuestionList);

            ViewBag.TestQuestionList = testSelectList;
            ViewBag.Tests            = tests;

            return(View());
        }
        // GET: Position/Edit/5
        public async Task<ActionResult> Edit(int? id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }

            Position position = await _client.GetPositionById(id);

            IEnumerable<Store> stores = null;
            using (var client = new StoreSvcClient())
            {
                stores = await client.GetStores();
            }

            var storeTitleList = new List<string>();
            var storeTitlesQuery = from s in stores select s.StoreName;

            storeTitleList.AddRange(storeTitlesQuery);
            var storeSelectList = new SelectList(storeTitleList);

            ViewBag.StoreTitles = storeSelectList;
            ViewBag.Stores = stores;

            IEnumerable<Test> tests = null;
            using (var client = new TestSvcClient())
            {
                tests = await client.GetTests();
            }

            var testQuestionList = new List<string>();
            var testTitlesQuery = from t in tests select t.TestName;

            testQuestionList.AddRange(testTitlesQuery);
            var testSelectList = new SelectList(testQuestionList);

            ViewBag.TestQuestionList = testSelectList;
            ViewBag.Tests = tests;

            if (position == null)
            {
                return HttpNotFound();
            }
            return View(position);
        }