public static CreatedStudentCommandRequest MapToCommand(this CriarAlunoModel model) { var entity = new People(model.Cpf, model.Nome, model.Email, PeopleType.Student); entity.AddUser(new User(model.Login, model.senha)); entity.AddStudent(new Domain.Entities.Student(model.Ra)); var result = new CreatedStudentCommandRequest(entity); return(result); }
public async Task <IActionResult> Aluno([FromForm] CriarAlunoModel model) { return(Ok(_mediator.Send(model.MapToCommand()))); }