Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
 
 
public ActionResult Edit([Bind(Include = "id,perssonneid,bookid,StartDate,backDate,exterieure")] commande commande)
        {
 
            book booker = db.boks.Find(commande.bookid);
            commande commnder = db.commands.Find(commande.id);
            Boolean change;
 
 
            if (commande.exterieure != commnder.exterieure) { change = true; }
            else { change = false; }
            //
            if(change==true && commande.exterieure==true)
            {
                booker.nbr_disponible--;
 
               db.Entry(booker).State = EntityState.Modified;
                db.SaveChanges();
            }
            if (change == true && commande.exterieure == false)
            {
                booker.nbr_disponible++;
 
                db.Entry(booker).State = EntityState.Modified;
                db.SaveChanges();
 
            }
 
            db.commands.Attach(commande);
            db.Entry(commande).State = EntityState.Modified;
            db.SaveChanges();
 
            return RedirectToAction("Index");
 
 
        }
je sais pour quoi il fonctionne pas explique moi comment fair
merci