Example #1
0
        //Obtention de tous les TypeCuisine
        public static List <TypeCuisine> GetAll()
        {
            //Obtention de la dataTable
            OdawaDS.typescuisineDataTable dt = DataProvider.GetTypesCuisine();
            //Création d'une liste vide
            List <TypeCuisine> lst = new List <TypeCuisine>();

            //Pour chaque restaurant dans la dataTable
            foreach (OdawaDS.typescuisineRow typeRow in dt.Rows)
            {
                TypeCuisine t = new TypeCuisine();
                t.id          = typeRow.id;
                t.type        = typeRow.type;
                t.description = typeRow.description;
                //Ajout à la liste
                lst.Add(t);
            }
            //Retourne la liste
            return(lst);
        }
Example #2
0
 //Mise à jour d'un TypeCuisine "t" passé en paramètre
 public static bool Update(TypeCuisine t)
 {
     OdawaDS.typescuisineDataTable dt = DataProvider.GetTypesCuisine();
     //Création d'une typescuisineRow et remplissage avec les attributs de "t"
     OdawaDS.typescuisineRow updRow = DataProvider.odawa.typescuisine.NewtypescuisineRow();
     updRow.id          = t.id;
     updRow.type        = t.type;
     updRow.description = t.description;
     //Envoi à la DAL
     try
     {
         DataProvider.UpdateTypeCuisine(updRow);
         //Si update ok, renvoie true
         return(true);
     }
     catch (System.Data.SqlClient.SqlException ex)
     {
         //Si SqlException, log et renvoie false
         LogManager.LogSQLException(ex.Message);
         return(false);
     }
 }