public Class BuildFrom(ClassInputDto classInputDto) { if (classInputDto == null) { return(null); } return(new Class { ClassId = classInputDto.Id, CourseId = this._courseRepository.GetCourseIdByName(classInputDto.Course), EndDate = classInputDto.EndDate, EndTime = classInputDto.EndTime, Local = classInputDto.Local, Shift = classInputDto.Shift[0], StartDate = classInputDto.StartDate, StartTime = classInputDto.StartTime, TeacherId = this._teacherRepository.GetTeacherIdByName(classInputDto.Teacher) }); }
public void Execute(ClassInputDto classInputDto, InsertClassResponse response, int lineNumber) { string lineWithError = $"Line {lineNumber} =>"; if (classInputDto == null) { response.AddError("001", $"Line {lineNumber} can't be null."); return; } this._parametersValidator.ClassId(classInputDto.Id, response, lineWithError); this._parametersValidator.Teacher(classInputDto.Teacher, response, lineWithError); this._parametersValidator.Course(classInputDto.Course, response, lineWithError); this._parametersValidator.Shift(classInputDto.Shift, response, lineWithError); this._parametersValidator.Date(classInputDto.StartDate, classInputDto.EndDate, response, lineWithError); this._parametersValidator.Time(classInputDto.StartTime, classInputDto.EndTime, response, lineWithError); }