/// <summary> /// maj Table /// </summary> /// <returns>indique si l action a reussi</returns> public static bool UpdateCommande(Commande CommandeToUpdate) { bool ok; using (BDDRestaurantEntities bdd = new BDDRestaurantEntities()) { try { //maj de l'atrticle ds l entitee Commande unCommande = bdd.Commande.Where(x => x.numCommande == CommandeToUpdate.numCommande).FirstOrDefault(); unCommande.dateHeureCommance = CommandeToUpdate.dateHeureCommance; unCommande.numTablee = CommandeToUpdate.numTablee; unCommande.idServeur = CommandeToUpdate.idServeur; unCommande.termine = CommandeToUpdate.termine; //save les modifs dans la base bdd.SaveChanges(); ok = true; } catch (Exception) { ok = false; } } return(ok); }
/// <summary> /// maj article /// </summary></returns> /// <returns>indique si l action a reussi public static bool UpdateArticle(Article ArticleToUpdate) { bool ok; using (BDDRestaurantEntities bdd = new BDDRestaurantEntities()) { try { //maj de l'atrticle ds l entitee Article unArticle = bdd.Article.Where(x => x.idArticle == ArticleToUpdate.idArticle).FirstOrDefault(); unArticle.designationArticle = ArticleToUpdate.designationArticle; unArticle.prixArticle = ArticleToUpdate.prixArticle; unArticle.photoArticle = ArticleToUpdate.photoArticle; unArticle.idCatArticle = ArticleToUpdate.idCatArticle; //save les modifs dans la base bdd.SaveChanges(); ok = true; } catch (Exception) { ok = false; } } return(ok); }
/// <summary> /// maj CategorieArticle /// </summary></returns> /// <returns>indique si l action a reussi public static bool UpdateCategorieArticle(CategorieArticle CategorieArticleToUpdate) { bool ok; using (BDDRestaurantEntities Bdd = new BDDRestaurantEntities()) { try { //maj du user ds l entitee CategorieArticle unArticle = Bdd.CategorieArticle.Where(x => x.idCatArticle == CategorieArticleToUpdate.idCatArticle).FirstOrDefault(); unArticle.idCatArticle = CategorieArticleToUpdate.idCatArticle; unArticle.libelleCatArticle = CategorieArticleToUpdate.libelleCatArticle; //save les modifs dans la base Bdd.SaveChanges(); ok = true; } catch (Exception) { ok = false; } } return(ok); }
/// <summary> /// maj Table /// </summary> /// <returns>indique si l action a reussi</returns> public static bool UpdateTablee(Tablee TableeToUpdate) { bool ok; using (BDDRestaurantEntities bdd = new BDDRestaurantEntities()) { try { //maj de l'atrticle ds l entitee Tablee unTablee = bdd.Tablee.Where(x => x.numTablee == TableeToUpdate.numTablee).FirstOrDefault(); unTablee.numTablee = TableeToUpdate.numTablee; unTablee.nbPlaceTablee = TableeToUpdate.nbPlaceTablee; //save les modifs dans la base bdd.SaveChanges(); ok = true; } catch (Exception) { ok = false; } } return(ok); }
/// <summary> /// ajoute une Table /// </summary> /// <param name="user"></param> /// <returns></returns> public static bool AddCommande(Commande Commande) { bool ok; using (BDDRestaurantEntities bdd = new BDDRestaurantEntities()) { try { //ajoute le user a l entitee bdd.Commande.Add(Commande); //save les modifs dans la base bdd.SaveChanges(); ok = true; } catch (Exception) { ok = false; } } return(ok); }
/// <summary> /// supp l Table /// </summary> /// <returns>indique si l action a reussi</returns> public static bool TermineCommande(Commande CommandeToTermine) { bool ok; using (BDDRestaurantEntities bdd = new BDDRestaurantEntities()) { try { //maj de l'Commande ds l entitee Commande unCommande = bdd.Commande.Where(x => x.numCommande == CommandeToTermine.numCommande).FirstOrDefault(); unCommande.termine = CommandeToTermine.termine; //save les modifs dans la base bdd.SaveChanges(); ok = true; } catch (Exception) { ok = false; } } return(ok); }
/// <summary> /// supp l article /// </summary></returns> /// <returns>indique si l action a reussi public static bool DeleteArticle(Article ArticleToDelete) { bool ok; using (BDDRestaurantEntities bdd = new BDDRestaurantEntities()) { try { //maj de l'article ds l entitee Article unArticle = bdd.Article.Where(x => x.idArticle == ArticleToDelete.idArticle).FirstOrDefault(); bdd.Article.Remove(unArticle); //save les modifs dans la base bdd.SaveChanges(); ok = true; } catch (Exception) { ok = false; } } return(ok); }
/// <summary> /// ajoute un CategorieArticle /// </summary> public static bool AddCategorieArticle(CategorieArticle categorieArticle) { bool ok; using (BDDRestaurantEntities Bdd = new BDDRestaurantEntities()) { try { //ajoute le categorieArticle a l entitee Bdd.CategorieArticle.Add(categorieArticle); //.AddObject(categorieArticle); //save les modifs dans la base Bdd.SaveChanges(); ok = true; } catch (Exception) { ok = false; } } return(ok); }