public List <Model.Trener> Get(TreneriSearchRequest request) { var query = _context.Trener.AsQueryable(); if (!string.IsNullOrWhiteSpace(request?.Ime)) { query = query.Where(x => x.Ime.StartsWith(request.Ime)); } if (!string.IsNullOrWhiteSpace(request?.Prezime)) { query = query.Where(x => x.Prezime.StartsWith(request.Prezime)); } var list = query.ToList(); return(_mapper.Map <List <Model.Trener> >(list)); }
public ActionResult <List <Model.Trener> > Get([FromQuery] TreneriSearchRequest request) { return(_service.Get(request)); }