コード例 #1
0
 public static int Atualizar(List <MensagemSistema> listaTextos)
 {
     try
     {
         var textoDAL = new TextosDAL();
         return(textoDAL.Atualizar(listaTextos));
     }
     catch (Exception)
     {
         throw;
     }
 }
コード例 #2
0
        public static List <MensagemSistema> ListarTextosSite()
        {
            try
            {
                var textoDAL = new TextosDAL();
                var lista    = textoDAL.Consultar("", "WEB");

                return(lista);
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #3
0
        public static MensagemSistema TextoDeAcordo()
        {
            try
            {
                var textoDAL = new TextosDAL();
                var lista    = textoDAL.Consultar("concordo", "WEB");

                return(lista[0]);
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #4
0
        public static List <MensagemSistema> Consultar(string categoria, string alias)
        {
            TextosDAL _textosDAL = new TextosDAL();
            var       lista      = new List <MensagemSistema>();

            if (categoria.Trim() != "" && alias.Trim() != "")
            {
                lista = _textosDAL.Consultar()
                        .Where(x => x.Categoria == categoria && x.Alias == alias)
                        .OrderBy(x => x.Texto)
                        .ToList();
            }
            else if (categoria.Trim() != "")
            {
                lista = _textosDAL.Consultar()
                        .Where(x => x.Categoria == categoria)
                        .OrderBy(x => x.Texto)
                        .ToList();
            }
            else if (alias.Trim() != "")
            {
                lista = _textosDAL.Consultar()
                        .Where(x => x.Alias == alias)
                        .OrderBy(x => x.Texto)
                        .ToList();
            }
            else
            {
                lista = _textosDAL.Consultar().OrderBy(x => x.Texto).ToList();
            }

            if (lista.Count() == 0)
            {
                lista.Add(new MensagemSistema {
                    Categoria = "", Texto = "", ID = -1
                });
            }

            return(lista);
        }