public CourseDto Map(Guid courseId, CourseCreatingDto courseCreatingDto) { CourseDto courseDto = new CourseDto(courseId, courseCreatingDto.Name, courseCreatingDto.Year) { Id = courseId }; return(courseDto); }
public async Task <CourseDto> Update(Guid existingCourseId, CourseCreatingDto courseCreatingDto) { CourseDto courseDto = this.courseMapper.Map(existingCourseId, courseCreatingDto); var course = GetCourseById(existingCourseId).Result; this.writeRepository.Update(this.courseMapper.Map(courseDto, course)); await this.writeRepository.SaveAsync(); return(courseDto); }
public async Task <CourseDto> Create(Guid professorId, CourseCreatingDto newCourse) { Domain.Entities.Professor professor = await professorService.GetProfessorById(professorId); Domain.Entities.Course course = this.courseMapper.Map(newCourse); await this.writeRepository.AddNewAsync(course); professor.Courses.Add(course); await this.writeRepository.SaveAsync(); return(this.courseMapper.Map(course)); }
public Domain.Entities.Course Map(CourseCreatingDto courseCreatingDto) { Domain.Entities.Course course = new Domain.Entities.Course(courseCreatingDto.Name, courseCreatingDto.Year); return(course); }