Пример #1
0
        public ActionResult <FamiliaProntuarioQtdeViewModel> GetFamiliaProntuarioQtde([FromHeader] string ibge, [FromRoute] int id_profissional)
        {
            try
            {
                ibge = _config.GetConnectionString(Helpers.Connection.GetConnection(ibge));
                FamiliaProntuarioQtdeViewModel itens = _repository.FamiliaProntuarioQtde(ibge, id_profissional);

                return(Ok(itens));
            }
            catch (Exception ex)
            {
                var response = TrataErro.GetResponse(ex.Message, true);
                return(StatusCode((int)HttpStatusCode.InternalServerError, response));
            }
        }
Пример #2
0
        public FamiliaProntuarioQtdeViewModel FamiliaProntuarioQtde(string ibge, int profissional)
        {
            try
            {
                var item = Helpers.HelperConnection.ExecuteCommand(ibge, conn =>
                                                                   conn.Query <int>(_command.GetProntuarioUso, new
                {
                    @id_profissional = profissional
                }).ToList());

                var qtdeprontuario = Helpers.HelperConnection.ExecuteCommand(ibge, conn =>
                                                                             conn.QueryFirstOrDefault <int>(_command.GetQtdMaximaFamiliaMicroarea));
                var familia = new FamiliaProntuarioQtdeViewModel();
                familia.max_familias       = qtdeprontuario;
                familia.prontuarios_em_uso = item;

                return(familia);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }