public StudentController(StudentApplicationService studentService) { _studentService = studentService; }
public SystemAdminController() { userService = new UserService(); studentApplicationService = new StudentApplicationService(); }
public void GivenIHaveTheFollowingStudents(Table table) { using (var repository = new ContosoUniversityEntityFrameworkRepository()) { foreach (var row in table.Rows) { var commandModel = DataHelper.CreateCommandModelFromTable<CreateStudent.CommandModel>(table, row); var response = new StudentApplicationService(repository).CreateStudent( new CreateStudent.Request( "test", commandModel)); if (response.HasValidationIssues) throw new ApplicationException(string.Join(" | ", response.ValidationDetails.Select(p => p.ErrorMessage))); DataHelper.AddEntityToRemove(EntityType.Student, response.StudentId); } } }