public List<Theme> recherche(string Key) { List<Theme> lstTheme = new List<Theme>(); foreach (var c in rThemeSQL.RechercheTheme(Key)) { Theme theme = new Theme(c.IdTheme, c.NomTheme, c.ComTheme); lstTheme.Add(theme); } return lstTheme; }
public static void addTheme(Theme theme) { var add = new tblTheme(); add.NomTheme = theme.nomTheme; add.ComTheme = theme.comTheme; db.tblTheme.Add(add); try { db.SaveChanges(); } catch (Exception e) { Console.WriteLine(e); } }
public static void setTheme(Theme theme) { var r = (from the in db.tblTheme where the.IdTheme == theme.idTheme select the).First(); r.NomTheme = theme.nomTheme; r.ComTheme = theme.comTheme; try { db.SaveChanges(); } catch (Exception e) { Console.WriteLine(e); } }