Example #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 }));
        }
Example #2
0
        public ActionResult Create(RessourceModel cm)
        {
            Ressource c = new Ressource();

            c.id       = cm.id;
            c.nom      = cm.nom;
            c.quantite = cm.quantite;
            c.type     = cm.type;
            c.etat     = cm.etat;



            cs.Add(c);
            cs.Commit();
            return(View("Index", "~/Views/Shared/_CustomerLayout.cshtml"));
        }