public List <CourseDTO> GetCourses() { var courses = new List <CourseDTO>(); foreach (var item in RT.GetCourses()) { var c = courseFactory.Create(); c.CourseName = item.CourseName; courses.Add(c); } return(courses); }
// Create course public static CourseCreate.Response Handle(IRepository repository, CourseCreate.Request request) { // Validation now performed in the dispacther decorators (See AutoValidate<T> in the DomainBootstrapper class) var container = new EntityStateWrapperContainer(); container.AddEntity(CourseFactory.Create(request.CommandModel)); var validationDetails = repository.Save(container); var courseId = default(int?); if (!validationDetails.HasValidationIssues) { courseId = container.FindEntity <Course>().CourseID; } return(new CourseCreate.Response(validationDetails, courseId)); }