Exemplo n.º 1
0
        public List <Lista> ObterUnidadesLst(int orgao, List <Unidade> lista = null)
        {
            List <Lista> list = null;

            try
            {
                if (lista != null && lista.Count > 0)
                {
                    list = new List <Lista>();
                    lista.ForEach(x => list.Add(new Lista()
                    {
                        Texto   = x.Sigla + " - " + x.Nome,
                        Id      = x.Id.ToString(),
                        IsAtivo = true
                    }));
                }
                else
                {
                    list = _da.ObterUnidadesLst(orgao);
                }
            }
            catch (Exception exc)
            {
                Validacao.AddErro(exc);
            }

            return(list);
        }