public static Noticia SelectById(int id) { NoticiaDSTableAdapters.tbl_noticiasTableAdapter adapter = new NoticiaDSTableAdapters.tbl_noticiasTableAdapter(); NoticiaDS.tbl_noticiasDataTable table = adapter.SelectById(id); if (table.Rows.Count == 0) { return(null); } return(RowToDto(table[0])); }
public static Noticia InsertWithReturn(string titulo, string descripcion, string fecha, int idEvento) { NoticiaDSTableAdapters.tbl_noticiasTableAdapter adapter = new NoticiaDSTableAdapters.tbl_noticiasTableAdapter(); NoticiaDS.tbl_noticiasDataTable table = adapter.InsertWithReturn(titulo, descripcion, Convert.ToDateTime(fecha), 0, idEvento); if (table.Rows.Count == 0) { return(null); } return(RowToDto(table[0])); }
public static List <Noticia> SelectByEvento(string id) { NoticiaDSTableAdapters.tbl_noticiasTableAdapter adapter = new NoticiaDSTableAdapters.tbl_noticiasTableAdapter(); NoticiaDS.tbl_noticiasDataTable table = adapter.SelectByEvento(Convert.ToInt32(id)); List <Noticia> listNoticia = new List <Noticia>(); foreach (NoticiaDS.tbl_noticiasRow row in table) { listNoticia.Add(RowToDto(row)); } return(listNoticia); }
public static List <Noticia> SelectTop5() { NoticiaDSTableAdapters.tbl_noticiasTableAdapter adapter = new NoticiaDSTableAdapters.tbl_noticiasTableAdapter(); NoticiaDS.tbl_noticiasDataTable table = adapter.selectTop5(); List <Noticia> listNoticia = new List <Noticia>(); foreach (NoticiaDS.tbl_noticiasRow row in table) { listNoticia.Add(RowToDto(row)); } return(listNoticia); }
public static void DeleteEvento(int id) { NoticiaDSTableAdapters.tbl_noticiasTableAdapter adapter = new NoticiaDSTableAdapters.tbl_noticiasTableAdapter(); adapter.DeleteAllEvents(id); }
public static void Delete(int id) { NoticiaDSTableAdapters.tbl_noticiasTableAdapter adapter = new NoticiaDSTableAdapters.tbl_noticiasTableAdapter(); adapter.DeleteNoticia(id); }
public static void Update(string titulo, string descripcion, string fecha, int id, int idEvento) { NoticiaDSTableAdapters.tbl_noticiasTableAdapter adapter = new NoticiaDSTableAdapters.tbl_noticiasTableAdapter(); adapter.UpdateNoticia(titulo, descripcion, Convert.ToDateTime(fecha), 0, id, id, idEvento); }