/// <summary> /// CourseModel típust konvertál Course típusra (entitás) /// </summary> /// <param name="course">Átkonvertálandó CourseModel</param> /// <returns>Course-á konvertált CourseModel</returns> public static Course ModelToEntity(CourseModel course) { Course newEntityCourse = new Course(); newEntityCourse.Id = course.CourseId; newEntityCourse.Room = course.Room; newEntityCourse.Teacher = course.Teacher; newEntityCourse.From = course.From; newEntityCourse.To = course.To; newEntityCourse.Day_Id = course.Day_Id; newEntityCourse.Subject_Id = course.Subject_Id; //newEntityCourse.Timetables = TimetableMapper.ModelCollectionToEntityCollection(course.Timetables); newEntityCourse.Day = DayMapper.ModelToEntity(course.Day); newEntityCourse.Subject = SubjectMapper.ModelToEntity(course.Subject); newEntityCourse.Name = course.Name; return(newEntityCourse); }
/// <summary> /// Course típust (entitás) konvertál CourseModel típusra /// </summary> /// <param name="course">Átkonvertálandó Course (entitás)</param> /// <returns>CourseModel-é konvertált Course</returns> public static CourseModel EntityToModel(Course course) { CourseModel newModelCourse = new CourseModel(); newModelCourse.CourseId = course.Id; newModelCourse.Room = course.Room; newModelCourse.Teacher = course.Teacher; newModelCourse.From = course.From; newModelCourse.To = course.To; newModelCourse.Day_Id = course.Day_Id; newModelCourse.Subject_Id = course.Subject_Id; newModelCourse.Name = course.Name; //newModelCourse.Timetables = TimetableMapper.EntityCollectionToModelCollection(course.Timetables); newModelCourse.Day = DayMapper.EntityToModel(course.Day); //newModelCourse.Subject = SubjectMapper.EntityToModel(course.Subject); newModelCourse.Subject = new SubjectModel(); newModelCourse.Subject.SubjectId = course.Subject.Id; newModelCourse.Subject.SubjectName = course.Subject.SubjectName; newModelCourse.Subject.IsLecture = (course.Subject.IsLecture == 0 ? false : true); newModelCourse.Subject.User_Id = course.Subject.User_Id; return(newModelCourse); }