public async Task <ActionResult> Post([FromBody] TurmaDTO turmaDTO) { await _turmaService.AdicionarTurma(_mapper.Map <Turma>(turmaDTO)); return(Ok(new { success = true, data = turmaDTO })); }
public TurmaViewModel AdicionarTurma(TurmaViewModel model) { var turma = TurmaAdapter.ToDomainModel(model); _turmaservice.AdicionarTurma(turma); model.ValidationResult = turma.ValidationResult; if (!turma.ValidationResult.IsValid) { return(model); } Commit(); return(model); }