public override Task <Courses> GetAllCourses(Empty request, ServerCallContext context) { Courses courses = new Courses(); List <Course> allCourses = logic.GetAllCourses(); foreach (var course in allCourses) { courses.Reply.Add(FromPoco(course)); } return(Task.FromResult <Courses>(courses)); }
public void GetAllCourses_ShouldReturnAllCourses() { // Arrange var testCourses = _inMemoryRep.GetAll() as List <Course>; var controller = new CourseController(_inMemoryRep); // Act var result = controller.GetAllCourses() as List <Course>; // Assert Assert.AreEqual(testCourses.Count, result.Count); }
public void Execute() { Console.Clear(); courseController.GetAllCourses(); Console.Write("Enter course Id: "); Int32.TryParse(Console.ReadLine(), out int courseId); var courseVM = courseController.GetCourseById(courseId); if (userController.AddCourseToUserProgress(courseVM)) { courseController.GetCourseMaterials(courseVM); courseController.PassCourseMaterials(); userController.UserPassCourse(courseVM); } }
public List <JSONCourseSend> GetAll() { List <JSONCourseSend> returnList = null; try { returnList = courseController.GetAllCourses(); Response.StatusCode = 200; } catch (Exception ex) { Response.StatusCode = 500; Response.WriteAsync(ex.Message); } return(returnList); }
public FormShowCourse() { InitializeComponent(); dataGridViewCourse.DataSource = CourseController.GetAllCourses(); }