public ApplicationSubmittedResponse Handle(ApplicationSubmittedCommand command) { var id = Guid.NewGuid(); var aggregate = new ApplicationAggregate(); aggregate.AcceptApplication(id, command.FirstName, command.LastName); var state = aggregate.State; _applicationRepository.SaveApplication(state); var response = new ApplicationSubmittedResponse().FromState(state); return response; }
public IHttpActionResult PostSubmitApplicationRequest(SubmitApplicationRequest request) { var command = new ApplicationSubmittedCommand(request.FirstName, request.LastName); var submitResponse = _applicationService.Handle(command); var evaluateReponse = _applicationService.Handle(new EvaluateApplicationCommand(submitResponse.ApplicationId)); if (evaluateReponse != null) { return Ok(evaluateReponse); } return NotFound(); }