public IActionResult GetEventType() { var tipoevents = _tipoEventoRepository.GetTipoEventi().ToList(); if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var tipoeventsDto = new List <TipoEventoDto>(); foreach (var tipoevento in tipoevents) { tipoeventsDto.Add(new TipoEventoDto { TipoEventoId = tipoevento.TipoEventoId, NomeTipoEvento = tipoevento.NomeTipoEvento }); } return(Ok(tipoeventsDto)); }