public ActionResult Editar(Noticia News) { NoticiaDAO _noticiaDAO = new NoticiaDAO(); _noticiaDAO.Editar(News); return(View()); }
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(); } } } }
// GET: Noticia public ActionResult Index() { IList <Noticia> n = new NoticiaDAO().ListarTodos(); return(View(n)); }
private void CarregarGridView() { var lstNoticias = new NoticiaDAO().BuscarTodos(); grdNoticias.DataSource = lstNoticias; grdNoticias.DataBind(); }
public ActionResult Cadastrar(Noticia news) { NoticiaDAO NewsDAO = new NoticiaDAO(); NewsDAO.Inserir(news); TempData["mensagem"] = "Nova noticia cadastrada com sucesso!"; return(RedirectToAction("Index")); }
public ActionResult Editar(Noticia News) { NoticiaDAO _noticiaDAO = new NoticiaDAO(); _noticiaDAO.Editar(News); TempData["Mensagem"] = "Noticia editada com sucesso!!"; return(View()); }
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)); }
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"); } }
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")); } }
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; } } } }
public ActionResult Consultar(int _id) { Noticia _news = new NoticiaDAO().BuscarPorId(_id); return(View(_news)); }
public List <Noticia_Web> ObterNoticia() { return(NoticiaDAO.ObterNoticia()); }
public void InserirNoticia(Noticia_Web item) { NoticiaDAO.InserirNoticia(item); }
public void RemoveNoticia(Noticia_Web item) { NoticiaDAO.RemoveNoticia(item); }
public void AtualizaNoticia(Noticia_Web item) { NoticiaDAO.AtualizaNoticia(item); }
public NoticiaDelegado(PeriodicoEntities cnn) { this.noticiaDAO = new NoticiaDAO(cnn); }
public ActionResult Editar(int id) { Noticia n = new NoticiaDAO().ConsultarPorId(id); return(View(n)); }