예제 #1
0
        public JsonResult AjoutRessourceAction(int ressourceId, int tacheId, int q)
        {
            Ressource     res    = new Ressource();
            TachRessource tachRs = new TachRessource();

            tachRs.quantite    = q;
            tachRs.RessourceId = ressourceId;
            tachRs.TacheId     = tacheId;
            res = Rs.GetById(ressourceId);
            if (res.quantite >= q)
            {
                res.quantite = res.quantite - q;
                if (res.quantite == 0)
                {
                    res.etat = (EtatRs)2;
                }
                var newQte = res.quantite;
                Rs.Update(res);
                Rs.Commit();
                TR.Add(tachRs);
                TR.Commit();
                return(Json(new { qte = newQte }));
            }
            // cs.AddResourceToTache(tache, ressource);


            return(Json(new { qte = res.quantite }));
        }
예제 #2
0
        public ActionResult Edit(int id, RessourceModel cm)
        {
            Ressource c = new Ressource();

            c          = cs.Get(t => t.id == id);
            c.nom      = cm.nom;
            c.quantite = cm.quantite;
            c.type     = cm.type;


            c.etat = cm.etat;

            cs.Update(c);
            cs.Commit();
            return(RedirectToAction("Index"));
        }