Beispiel #1
0
 public void SaveUpdateRecommandation(Recommandation recom)
 {
     using (VeoliaContext db = new VeoliaContext())
     {
         db.Entry(recom).State = EntityState.Modified;
         db.SaveChanges();
     }
 }
Beispiel #2
0
 public void DeleteRecommandation(int ID)
 {
     using (VeoliaContext db = new VeoliaContext())
     {
         Recommandation recom = db.Recommandations.Find(ID);
         db.Entry(recom).State = EntityState.Deleted;
         db.SaveChanges();
     }
 }
Beispiel #3
0
 public int SaveNewRecommandation(Recommandation recom)
 {
     using (VeoliaContext db = new VeoliaContext())
     {
         Recommandation NewRecom = db.Recommandations.Add(recom);
         db.SaveChanges();
         return(recom.recommandationID);
     }
 }
Beispiel #4
0
        public ActionResult Create([Bind(Include = "clientID,userId,clientName,clientSurame,clientEmail,clientNumTel,clientDateCreation,clintDateModification,adress")] Client client)
        {
            if (ModelState.IsValid)
            {
                //Création Client
                client.clientDateCreation = DateTime.Now;
                Client addedclient = db.Clients.Add(client);

                //Création formulaire
                FormControlConform form = new FormControlConform();
                form.clientID = client.clientID;
                form.userID   = client.userId;
                FormControlConform addedform = db.FormControlConforms.Add(form);

                //Création Première relation
                RelationFormAdress relation = new RelationFormAdress();
                relation.adress = addedclient.adress[0];
                RelationFormAdress addedrelation = db.RelationFormAdresss.Add(relation);
                if (true)
                {
                }
                //Création deuxième relation Facture
                RelationFormAdress relationfact = new RelationFormAdress();
                relationfact.adress        = addedclient.adress[1];
                relationfact.adressFacture = true;

                //Création de recommandation
                RelationFormAdress addedrelationfact = db.RelationFormAdresss.Add(relationfact);
                Recommandation     recom             = new Recommandation();
                db.Recommandations.Add(recom);

                //save data
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.userId = new SelectList(db.Users, "userID", "email", client.userId);
            return(View(client));
        }
Beispiel #5
0
 public int PostRecommandation(Recommandation recommandation)
 {
     return(_repo.SaveNewRecommandation(recommandation));
 }
Beispiel #6
0
 public void PutRecommandation(Recommandation recommandation)
 {
     _repo.SaveUpdateRecommandation(recommandation);
 }