Example #1
0
 public Boolean AgregarNoticia(Noticia _noticia)
 {
     try
     {
         _noticiasDBContext.Noticia.Add(_noticia);
         _noticiasDBContext.SaveChanges();
         return(true);
     }
     catch (Exception error)
     {
         return(false);
     }
 }
Example #2
0
 public bool Agregar(Noticia NoticiaAgregar)
 {
     try
     {
         _NoticiaDB.Noticia.Add(NoticiaAgregar);
         _NoticiaDB.SaveChanges();
         return(true);
     }
     catch (Exception error)
     {
         return(false);
     }
 }
 public bool Agregar(Noticia newNoticia)
 {
     try
     {
         noticiasDB.Noticia.Add(newNoticia);
         noticiasDB.SaveChanges();
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
Example #4
0
 public Boolean AgregarAutor(Autor _autor)
 {
     try
     {
         _noticiaDbContext.Autor.Add(_autor);
         _noticiaDbContext.SaveChanges();
         return(true);
     }
     catch (Exception e)
     {
         return(false);
     }
 }
Example #5
0
 public bool AddNews(Noticia Noticia)
 {
     try
     {
         _noticiasDBContext.Add(Noticia);
         _noticiasDBContext.SaveChanges();
         return(true);
     }
     catch (Exception ex)
     {
         string error = ex.Message;
         return(false);
     }
 }
        public Boolean AgregarNoticia(Noticia noticia)
        {
            try
            {
                _noticiasDBContext.Noticia.Add(noticia);
                _noticiasDBContext.SaveChanges();
            }
            catch (Exception ex)
            {
                new Exception(ex.Message);
            }

            return(true);
        }
Example #7
0
 public Boolean AgregarNoticia(Noticias noticia)
 {
     try
     {
         dBContext.Noticia.Add(noticia);
         dBContext.SaveChanges();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Example #8
0
        public bool eliminarNoticia(int noticiaID)
        {
            try
            {
                var noticiaEliminar = _noticiaDBContext.Noticia.FirstOrDefault(x => x.NoticiaID == noticiaID);
                _noticiaDBContext.Noticia.Remove(noticiaEliminar);
                _noticiaDBContext.SaveChanges();
                return(true);
            }
            catch (Exception ex)
            {
                return(true);

                throw;
            }
        }