Beispiel #1
0
        public ActionResult GetNotas(DTOBuscador model)
        {
            bool load = false;

            try

            {
                if (!context.Etiquetas.Any())
                {
                    context.Etiquetas.AddRange(Etiquetas);
                    context.SaveChanges();
                }
                var Data = context.Notas.Select(c => new {
                    Titulo    = c.Titulo,
                    Contenido = c.Contenido.ToUpper().Substring(0, 50),
                    NotaId    = c.NotaId
                }).ToList();

                if (!string.IsNullOrEmpty(model.buqueda))
                {
                    Data = context.Notas.Select(c => new  {
                        Titulo    = c.Titulo,
                        Contenido = c.Contenido.ToUpper().Substring(0, 50),
                        NotaId    = c.NotaId
                    }).Where(c => c.Titulo.ToUpper().Contains(model.buqueda) ||
                             c.Contenido.Contains(model.buqueda)).ToList();
                }
                load = true;
                return(Json(new { load = load, data = Data }));
            }
            catch (Exception ex)
            {
            }
            return(Json(new { load = load }));
        }
Beispiel #2
0
        public ActionResult GetNotasByEtiqueta(DTOBuscador model)
        {
            bool load = false;

            try
            {
                var ListNotas = context.NotaEtiquetas.Where(c => c.EtiquetaId == model.id).Select(c => c.NotaId).ToList();

                var Data = context.Notas.Select(c => new {
                    Titulo    = c.Titulo,
                    Contenido = c.Contenido.ToUpper().Substring(0, 50),
                    NotaId    = c.NotaId
                }).Where(c => ListNotas.Contains(c.NotaId)).ToList();

                load = true;
                return(Json(new { load = load, data = Data }));
            }
            catch (Exception ex)
            {
            }
            return(Json(new { load = load }));
        }