예제 #1
0
        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));
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
            }
        }
예제 #4
0
        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();
 }