public override Task <StudentList> GetStudents(Empty empty, ServerCallContext context) { var list = _service.GetStudents(); StudentList rList = new StudentList(); foreach (var item in list) { rList.StudentList_.Add(ProtoMapper.MapFromStudentPoco(item)); } return(Task.FromResult(rList)); }
public override Task <StudentList> GetEnrolledStudents(CourseKey key, ServerCallContext context) { List <EnrollmentPoco> list = _service.GetEnrolledStudents(key.Id); StudentList rList = new StudentList(); foreach (var item in list) { rList.StudentList_.Add(ProtoMapper.MapFromStudentPoco(item.Student)); } return(Task.FromResult(rList)); }
public override Task <Student> GetStudent(StudentKey req, ServerCallContext context) { var poco = _service.GetStudent(req.Id); if (poco != null) { return(Task.FromResult(ProtoMapper.MapFromStudentPoco(poco))); } else { return(Task.FromResult(new Student() { Id = 0 })); } }