/// <summary> /// Constructor for Create action of a course /// </summary> /// <param name="id">Id of the instructor</param> public CourseInstructorViewModel(int id) { Instructor = new Instructor {Id = id}; Course = new Course { OwnerId = Instructor.Id, Status = true, }; GroupSummaries = new List<GroupSummary>(); MessageInfos = new List<MessageInfo>(); }
/// <summary> /// Convert retrieved course for editing /// </summary> /// <param name="course">Course with owner</param> public CourseInstructorViewModel(Course course) { Course = course; Instructor = course.Owner; GroupSummaries = course.Groups.Select(g => new GroupSummary (g)).ToList(); MessageInfos = course.CourseMessages .Select(m => new MessageInfo(m)).ToList(); StudentInfos = course.Students .Select(s=>new StudentInfo(s,courseId:course.Id)) .ToList(); }
public void delete_applies_soft_delete() { //var repo = new CourseRepository(new MOOCollab2UOW()); var repo = new CourseRepository(new TestDb()); var testCourse = new Course { Id = 1, Status = true }; //act repo.Delete(testCourse); var changedCourse = repo.CourseAndInstructorByCourseId(1);//get changed course //assert Assert.IsFalse(changedCourse.Status); Assert.IsNull(changedCourse.Groups.FirstOrDefault(g => g.Status == true)); }