public async Task <IEnumerable <Reader> > Get(string userName = "") { if (!string.IsNullOrEmpty(userName)) { var readers = await _repository.Find(new InputModel { Username = userName }); return(readers); } else { var readers = await _repository.All(); return(readers.Readers); } }
// GET: ReadersController public async Task <ActionResult> Index(string userName = "") { if (!string.IsNullOrEmpty(userName)) { var readers = await _repository.Find(new SearchRequest { UserName = userName }); return(View(new ReaderViewModel { Readers = readers, ResultsType = ResultsType.Search })); } else { var readers = await _repository.All(); return(View(readers)); } }