public async Task <UtilisateurRole> AjouterUtilisateurRole(UtilisateurRole utilisateurRole) { if (utilisateurRole == null) { throw new UtilisateurRoleNotFoundException(); } context.UtilisateurRole.Add(utilisateurRole); await context.SaveChangesAsync(); return(utilisateurRole); }
public async Task <Commentaire> AjouterCommentaire(Commentaire commentaire) { if (commentaire == null) { throw new CommentaireNotFoundException(); } context.Commentaire.Add(commentaire); await context.SaveChangesAsync(); return(commentaire); }
public async Task <LigneProduit> AjouterLigneProduit(LigneProduit ligneProduit) { if (ligneProduit == null) { throw new LigneProduitNotFoundException(); } context.LigneProduit.Add(ligneProduit); await context.SaveChangesAsync(); return(ligneProduit); }
public async Task <LigneCommande> AjouterLigneCommande(LigneCommande ligneCommande) { if (ligneCommande == null) { throw new LigneCommandeNotFoundException(); } context.LigneCommande.Add(ligneCommande); await context.SaveChangesAsync(); return(ligneCommande); }
public async Task ModifierBox(Box box, BoxDTO boxDTO) { box.Id = boxDTO.Id; box.Nom = boxDTO.Nom; box.PrixUnitaireHtva = boxDTO.PrixUnitaireHtva; box.Tva = boxDTO.Tva; box.Promotion = boxDTO.Promotion; box.Description = boxDTO.Description; box.Photo = boxDTO.Photo; box.Affichable = boxDTO.Affichable; box.DateCreation = boxDTO.DateCreation; context.Entry(box).OriginalValues["RowVersion"] = boxDTO.RowVersion; await context.SaveChangesAsync(); }
public async Task <Utilisateur> AjouterUtilisateur(Utilisateur utilisateur) { if (utilisateur == null) { throw new UtilisateurNotFoundException(); } context.Utilisateur.Add(utilisateur); UtilisateurRoleDAO utilisateurRoleDAO = new UtilisateurRoleDAO(context); await context.SaveChangesAsync(); await utilisateurRoleDAO.AjouterDefaultRole(utilisateur); return(utilisateur); }
public async Task <Produit> AjouterProduit(Produit produit) { if (produit == null) { throw new ProduitNotFoundException(); } context.Produit.Add(produit); await context.SaveChangesAsync(); return(produit); }
public async Task <Commande> AjouterCommande(Commande commande) { if (commande == null) { throw new CommandeNotFoundException(); } context.Commande.Add(commande); await context.SaveChangesAsync(); LigneCommandeDAO ligneCommandeDAO = new LigneCommandeDAO(context); foreach (var ligneCommande in commande.LigneCommande) { await ligneCommandeDAO.AjouterLigneCommande(ligneCommande); } return(commande); }
public async Task <Adresse> AjouterAdresse(Adresse adresse) { if (adresse == null) { throw new AdresseNotFoundException(); } Adresse adresseExiste = await GetAdresseByAdresse(adresse); if (adresseExiste != null) { return(adresseExiste); } context.Adresse.Add(adresse); await context.SaveChangesAsync(); return(adresse); }