Exemple #1
0
        public ActionResult Index(string name = null)
        {
            IEnumerable <TestMasterViewModel> testMasterViewModel;
            IEnumerable <TestMaster>          testMaster;

            testMaster          = testMasterService.GetMasterTests(name).ToList();
            testMasterViewModel = Mapper.Map <IEnumerable <TestMaster>, IEnumerable <TestMasterViewModel> >(testMaster);
            // throw new Exception();
            return(View(testMasterViewModel));
            //return View();
        }
        public IActionResult Get()
        {
            IEnumerable <TestMasterViewModel> testMasterViewModel;

            testMasterViewModel = iTestMasterService.GetMasterTests().ToList();
            return(new  ObjectResult(testMasterViewModel));
        }
Exemple #3
0
        public IHttpActionResult Get()
        {
            IEnumerable <TestMasterViewModel> testMasterViewModel;

            testMasterViewModel = cache.GetOrSet("GetAllTestMaster", () => iTestMasterService.GetMasterTests().ToList());
            return(Ok(testMasterViewModel));
        }
        /// <summary>
        /// TO GET ALL TEST MASTERS
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public IEnumerable <SelectListItem> GetAllTestMasters(string name = null)
        {
            List <TestMaster> testsMasterList = new List <TestMaster>();

            testsMasterList = testMasterService.GetMasterTests(name).Where(x => x.IsActive == true).ToList();

            IEnumerable <TestMasterViewModel> _testsViewModel;

            _testsViewModel = Mapper.Map <IEnumerable <TestMaster>, IEnumerable <TestMasterViewModel> >(testsMasterList);

            IEnumerable <SelectListItem> _testlist = _testsViewModel.AsEnumerable()
                                                     .Select(testItem => new SelectListItem()
            {
                Text = testItem.TestMasterName, Value = testItem.TestMasterID.ToString()
            });

            return(_testlist);
        }