public ActionResult Index() { List <AppSettingViewModel> model = new List <AppSettingViewModel>(); try { ViewBag.SearchModel = new AppSettingViewModel { }; ViewBag.Setting2Group = _mapper.Map <List <AppSetting2AppSettingGroupViewModel> >(_appSetting2AppSettingGroupService.Find(new AppSetting2AppSettingGroup())); ViewBag.Groups = _mapper.Map <List <AppSettingGroupViewModel> >(_appSettingGroupService.Find(new AppSettingGroup())); model = _mapper.Map <List <AppSettingViewModel> >(_appSettingService.Find(new AppSetting())); } catch (Exception ex) { _logger.Error(ex); if (ex.InnerException != null && ex.InnerException.Source.Equals(GeneralMessages.ExceptionSource)) { ModelState.AddModelError(string.Empty, ex.Message); } else { ModelState.AddModelError(string.Empty, GeneralMessages.UnexpectedError); } } return(View(model)); }