public async Task <Evento> AddEventos(Evento model) { try { _geralPersistence.Add(model); if (await _geralPersistence.SaveChangesAsync()) { return(await _eventoPersistence.GetEventoByIdAsync(model.Id, false)); } return(null); } catch (Exception e) { throw new Exception(e.Message); } }
public async Task <Evento> Add(Evento model) { try { _generic.Add <Evento>(model); if (await _generic.SaveChangesAsync()) { return(await _evento.GetEventoByIdAsync(model.Id, false)); } return(null); } catch (Exception ex) { throw ex; } }
public async Task <EventoDto> Add(EventoDto model) { try { var evento = _mapper.Map <Evento>(model); _geralPersist.Add <Evento>(evento); if (await _geralPersist.SaveChangesAsync()) { var eventoRetorno = await _eventoPersist.GetEventoByIdAsync(evento.Id, false); return(_mapper.Map <EventoDto>(eventoRetorno)); } return(null); } catch (Exception ex) { throw new Exception(ex.Message); } }