Example #1
0
        public async Task CreateCourseProgram()
        {
            coursePrograms = new List <CourseProgram>(CourseProgramMock.listCourseProgram.Select(x => (CourseProgram)x.Clone()));
            var courseId = await storage.CourseAddOrUpdate((Course)listCourse[0].Clone());

            coursePrograms[1].CourseId = courseId;
            coursePrograms[0].CourseId = courseId;

            var courseProgramId = await storage.CourseProgramAddOrUpdate(coursePrograms[0]);

            coursePrograms[0].Id = courseProgramId;
            coursePrograms[1].Id = courseProgramId;
            var courseProgram = await storage.CourseProgramGetById(courseProgramId);

            //courseProgram.ProgramDetails = coursePrograms[1].ProgramDetails;
            Assert.IsTrue(DeepEqual(coursePrograms[0], courseProgram));
        }
Example #2
0
        public async Task <ActionResult <CourseProgramOutputModel> > GetObjById(int id)
        {
            if (id.Equals(null))
            {
                return(BadRequest("Id is empty"));
            }

            var courseProgram = CourseProgramMapper.ToCourseProgramOutputModel(await courseStorage.CourseProgramGetById(id));

            if (courseProgram == null)
            {
                return(NotFound("Object not found"));
            }

            return(Ok(courseProgram));
        }