public ActionResult AddTache(string utilisateurId, string mandatId, [FromBody] TacheViewModel tache) { var utilisateur = utilisateurGraphRepository.GetOne(utilisateurId); var mandatModel = mandatGraphRepository.GetOne(mandatId); var tacheModel = new Tache { Description = tache.Description }; tacheGraphRepository.Add(tacheModel); editionObjectGraphRepository.AjouterNoeud(objetAjoute: tacheModel, viewModelProprieteNom: "Taches", noeudModifie: mandatModel); tache.GraphId = tacheModel.GraphKey; return(Json(tache)); }
public ActionResult DeleteTache(string utilisateurId, string mandatId, [FromBody] TacheViewModel tache) { var utilisateur = utilisateurGraphRepository.GetOne(utilisateurId); var mandat = mandatGraphRepository.GetOne(mandatId); var taches = mandat.Taches; if (taches.Any(x => x.GraphKey == tache.GraphId)) { var tacheModel = tacheGraphRepository.GetOne(tache.GraphId); editionObjectGraphRepository.SupprimerNoeud(tacheModel, "Taches", mandat); } else { var edition = mandat.EditionObjects.Find(x => x.ObjetAjoute?.GraphKey == tache.GraphId); editionObjectGraphRepository.Delete(edition); } return(Json(tache)); }