public List <Agenda> Get(int pacienteId) { try { var agendas = new List <Agenda>(); _dataContext.BeginTransaction(); agendas = _agendaRepository.Get(_dataContext, pacienteId); ResponseService = new ResponseService() { Type = ResponseTypeEnum.Success, Message = "Agenda consultada com sucesso." }; return(agendas); } catch (Exception e) { ResponseService = new ResponseService() { Type = ResponseTypeEnum.Error, Message = "Houve uma falha ao consultar a agenda." }; return(new List <Agenda>()); } finally { _dataContext.Finally(); } }
public IHttpActionResult Get() { int id = Convert.ToInt32(User.Identity.Name); UsuarioCurso uc = new UsuarioCurso(); uc = _context.UsuarioCursos .FirstOrDefault(x => x.UsuarioID == id); var dados = _repository.Get(Convert.ToInt32(User.Identity.Name), uc.CursoID); return(Ok(dados)); }