// 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)); }
// 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); }