Пример #1
0
        public ActionResult Editar(Noticia News)
        {
            NoticiaDAO _noticiaDAO = new NoticiaDAO();

            _noticiaDAO.Editar(News);
            return(View());
        }
Пример #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                return;
            }

            if (!string.IsNullOrWhiteSpace(Request.QueryString["id"]))
            {
                var id = Convert.ToInt32(Request.QueryString["id"]);
                if (id > 0)
                {
                    var noticia = new NoticiaDAO().BuscarPorId(id);
                    if (noticia != null)
                    {
                        lblTitulo.Text    = noticia.Titulo;
                        lblDescricao.Text = noticia.Subtitulo;
                        lblTexto.Text     = noticia.Texto;
                        imgNoticia.Attributes.Add("src", ResolveUrl(string.Format("~/Uploads/{0}", noticia.Foto)));

                        var lst = new ComentarioDAO().BuscarPorNoticia(noticia.Cod);
                        grdComentario.DataSource = lst;
                        grdComentario.DataBind();
                    }
                }
            }
        }
Пример #3
0
        // GET: Noticia
        public ActionResult Index()
        {
            IList <Noticia> n = new NoticiaDAO().ListarTodos();


            return(View(n));
        }
Пример #4
0
        private void CarregarGridView()
        {
            var lstNoticias = new NoticiaDAO().BuscarTodos();

            grdNoticias.DataSource = lstNoticias;
            grdNoticias.DataBind();
        }
Пример #5
0
        public ActionResult Cadastrar(Noticia news)
        {
            NoticiaDAO NewsDAO = new NoticiaDAO();

            NewsDAO.Inserir(news);
            TempData["mensagem"] = "Nova noticia cadastrada com sucesso!";
            return(RedirectToAction("Index"));
        }
Пример #6
0
        public ActionResult Editar(Noticia News)
        {
            NoticiaDAO _noticiaDAO = new NoticiaDAO();

            _noticiaDAO.Editar(News);
            TempData["Mensagem"] = "Noticia editada com sucesso!!";
            return(View());
        }
Пример #7
0
        public ActionResult Index()
        {
            NoticiaDAO dao = new NoticiaDAO();
            //IList<Noticia> lista = dao.ListarTodos().Take<Noticia>(3).ToList<Noticia>();
            IList <Noticia> lista = dao.ListarTodos().OrderByDescending(x => x.Data).Take <Noticia>(3).ToList();

            return(View(lista));
        }
Пример #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                return;
            }
            var lst = new NoticiaDAO().BuscarTodos();

            gridView.DataSource = lst;
            gridView.DataBind();
        }
        public static String agregarNoticia(String titulo, String desc, String imagen)
        {
            int resultado = new NoticiaDAO().agregarNoticia(titulo, desc, imagen);

            if (resultado != 0)
            {
                return("true");
            }
            else
            {
                return("false");
            }
        }
        public static String editarNoticia(String id, String titulo, String desc, String imagen)
        {
            bool resultado = new NoticiaDAO().editarNoticia(id, titulo, desc, imagen);

            if (resultado)
            {
                return("true");
            }
            else
            {
                return("false");
            }
        }
        public static String eliminarNoticia(String id)
        {
            bool resultado = new NoticiaDAO().delete(id);

            if (resultado)
            {
                return("true");
            }
            else
            {
                return("false");
            }
        }
Пример #12
0
        public ActionResult Index()
        {
            if (Session["UsuarioLogado"] != null)
            {
                NoticiaDAO      dao   = new NoticiaDAO();
                IList <Noticia> lista = dao.ListarTodos();

                return(View(lista));
            }
            else
            {
                TempData["Mensagem"] = "Sessão Expirada!, Por Favor efetuar login novamente";
                return(RedirectToAction("Index", "Admin"));
            }
        }
Пример #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                return;
            }

            if (!string.IsNullOrWhiteSpace(Request.QueryString["id"]))
            {
                var id = Convert.ToInt32(Request.QueryString["id"]);
                if (id > 0)
                {
                    var obj = new NoticiaDAO().BuscarPorId(id);
                    if (obj != null)
                    {
                        hdfCod.Value      = obj.Cod.ToString();
                        txtTitulo.Text    = obj.Titulo;
                        txtdescricao.Text = obj.Subtitulo;
                        txtCorpo.Text     = obj.Texto;
                    }
                }
            }
        }
Пример #14
0
        public ActionResult Consultar(int _id)
        {
            Noticia _news = new NoticiaDAO().BuscarPorId(_id);

            return(View(_news));
        }
Пример #15
0
 public List <Noticia_Web> ObterNoticia()
 {
     return(NoticiaDAO.ObterNoticia());
 }
Пример #16
0
 public void InserirNoticia(Noticia_Web item)
 {
     NoticiaDAO.InserirNoticia(item);
 }
Пример #17
0
 public void RemoveNoticia(Noticia_Web item)
 {
     NoticiaDAO.RemoveNoticia(item);
 }
Пример #18
0
 public void AtualizaNoticia(Noticia_Web item)
 {
     NoticiaDAO.AtualizaNoticia(item);
 }
Пример #19
0
 public NoticiaDelegado(PeriodicoEntities cnn)
 {
     this.noticiaDAO = new NoticiaDAO(cnn);
 }
Пример #20
0
        public ActionResult Editar(int id)
        {
            Noticia n = new NoticiaDAO().ConsultarPorId(id);

            return(View(n));
        }