public override Task <Empty> UpdateCourse(Course course, ServerCallContext context) { CoursePoco poco = ProtoMapper.MapToCoursePoco(course); _service.UpdateCourse(poco); return(Task.FromResult(new Empty())); }
public override Task <Empty> UpdateStudent(Student student, ServerCallContext context) { StudentPoco poco = ProtoMapper.MapToStudentPoco(student); _service.UpdateStudent(poco); return(Task.FromResult(new Empty())); }
public override Task <CourseKey> AddCourse(Course course, ServerCallContext context) { CoursePoco poco = ProtoMapper.MapToCoursePoco(course); int id = _service.AddCourse(poco); return(Task.FromResult(new CourseKey() { Id = id })); }
public override Task <CourseList> GetEnrolledCourses(StudentKey key, ServerCallContext context) { List <EnrollmentPoco> list = _service.GetEnrolledCourses(key.Id); CourseList rList = new CourseList(); foreach (var item in list) { rList.CourseList_.Add(ProtoMapper.MapFromCoursePoco(item.Course)); } 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 <CourseList> GetCourses(Empty empty, ServerCallContext context) { var list = _service.GetCourses(); CourseList rList = new CourseList(); foreach (var item in list) { rList.CourseList_.Add(ProtoMapper.MapFromCoursePoco(item)); } return(Task.FromResult(rList)); }
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 <StudentKey> AddStudent(Student student, ServerCallContext context) { int id = 0; StudentPoco poco = ProtoMapper.MapToStudentPoco(student); id = _service.AddStudent(poco); return(Task.FromResult(new StudentKey() { Id = id })); }
public override Task <Course> GetCourse(CourseKey req, ServerCallContext context) { var poco = _service.GetCourse(req.Id); if (poco != null) { return(Task.FromResult(ProtoMapper.MapFromCoursePoco(poco))); } else { return(Task.FromResult(new Course() { Id = 0 })); } }
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 })); } }