public IEnumerable <ReporterToListEntity> GetListReporter(string name) { List <ReporterToListEntity> lstReporterEntity = null; if (string.IsNullOrEmpty(name)) { var lstReporter = _reporterRepository.All; lstReporterEntity = Mapper.Map <List <ReporterToListEntity> >(lstReporter); } else { var lstReporter = _reporterRepository.GetMany(r => r.Name.Contains(name) || r.Position.Name.Contains(name)); lstReporterEntity = Mapper.Map <List <ReporterToListEntity> >(lstReporter); } return(lstReporterEntity); }
public ViewResult Index() { List <ReporterGroupView> lstReporterGroups = new List <ReporterGroupView>(); foreach (var p in _positionLevelRepository.All) { var reporters = _reporterRepository.GetMany(r => r.Position.PositionLevelId == p.Id && r.IsShow == true).ToList(); var rep = new ReporterGroupView { Id = p.Id, Name = p.Name, Reporters = reporters }; lstReporterGroups.Add(rep); } return(View(lstReporterGroups)); //return View(_reporterRepository.AllIncluding(reporter => reporter.Videos, reporter => reporter.Articles).ToList()); }