public IActionResult Get([FromQuery] string name) { IEnumerable <Classroom> result; if (!string.IsNullOrWhiteSpace(name)) { result = _classroomRepository.Find(name); } else { result = _classroomRepository.Fetch(); } var results = Mapper.Map <IEnumerable <ClassroomModel> >(result); return(new ObjectResult(results)); }
public Classroom getByIdAsync(int id) => _repository.Find(x => x.Id == id);