public JsonResult GetAllPartMaster() { var objGetTestMasterByTestIdViewModel = _iTestMaserClient.GetAllPartMaster(); IEnumerable <SelectListItem> testsList = new List <SelectListItem>(); //use of helper method to create select list item testsList = SelectListItemAdapter.GetSelectListItemCollection(objGetTestMasterByTestIdViewModel, s => s.PartNumber, s => Convert.ToString(s.PartMasterID)); return(Json(testsList, JsonRequestBehavior.AllowGet)); }
public JsonResult GetAllTest(string name = null) { List <TestsViewModel> testsViewModelList; testsViewModelList = _iTestClient.GetAllTest(); IEnumerable <SelectListItem> testsList = new List <SelectListItem>(); testsList = SelectListItemAdapter.GetSelectListItemCollection(testsViewModelList, s => s.TestName, s => Convert.ToString(s.TestID)); //testsList = testsViewModelList.AsEnumerable().Select(testItem => new SelectListItem() { Text = testItem.TestName, Value = testItem.TestID.ToString() }); return(Json(testsList, JsonRequestBehavior.AllowGet)); }
public JsonResult GetAllTestMasters(int?testMasterid, Boolean ForCopyTo = false) { IEnumerable <SelectListItem> testMasterList = new List <SelectListItem>(); if (!ForCopyTo) { //use of helper method to create select list item testMasterList = SelectListItemAdapter.GetSelectListItemCollection(_iTestMaserClient.GetAll(), o => o.TestMasterName, o => o.TestMasterID.ToString(), Convert.ToString(testMasterid)); } else { testMasterList = SelectListItemAdapter.GetSelectListItemCollection(_iTestMaserClient.GetAll(), o => o.TestMasterName, o => Convert.ToString(o.TestMasterID)); } return(Json(testMasterList, JsonRequestBehavior.AllowGet)); }