public IActionResult Post([FromBody] AlunoRequestDTO model) { var aluno = _mapper.Map <Aluno>(model); _repository.Add(aluno); _repository.SaveChanges(); return(Created(nameof(GetById), model)); }
public IActionResult Put([FromRoute] int id, [FromBody] AlunoRequestDTO model) { var aluno = _repository.GetById(id); if (aluno == null) { return(NotFound()); } _mapper.Map(model, aluno); _repository.Update(aluno); _repository.SaveChanges(); return(NoContent()); }