public ActionResult AddTechnologie(string utilisateurId, string mandatId, [FromBody] TechnologieViewModel technologie) { var utilisateur = utilisateurGraphRepository.GetOne(utilisateurId); var mandatModel = mandatGraphRepository.GetOne(mandatId); var technologieModel = technologieGraphRepository.GetOne(technologie.GraphId); editionObjectGraphRepository.AjouterNoeud(objetAjoute: technologieModel, viewModelProprieteNom: "Technologies", noeudModifie: mandatModel); technologie.GraphId = technologieModel.GraphKey; return(Json(technologie)); }
public ActionResult Add(string utilisateurId, [FromBody] MandatViewModel mandat) { var utilisateur = utilisateurGraphRepository.GetOne(utilisateurId); var conseiller = utilisateur.Conseiller; var societeDeConseil = new Employeur { Nom = mandat.NomEntreprise }; var client = new Client { Nom = mandat.NomClient }; var projet = new Projet { DateDebut = mandat.DebutProjet, CellulaireReference = mandat.CellulaireReference, Description = mandat.ContexteProjet, CourrielReference = mandat.CourrielReference, Envergure = mandat.Envergure, DateFin = mandat.FinProjet, FonctionReference = mandat.FonctionReference, NomReference = mandat.NomReference, TelephoneReference = mandat.TelephoneReference, Nom = mandat.TitreProjet, SocieteDeConseil = societeDeConseil, Client = client, Technologies = mandat.Technologies.Select(x => technologieGraphRepository.GetOne(x.GraphId)).ToList() }; var fonction = fonctionGraphRepository.GetOne(mandat.GraphIdFonction); var mandatModel = new Mandat { DateDebut = mandat.DebutMandat, Efforts = mandat.Efforts, DateFin = mandat.FinMandat, Numero = mandat.NumeroMandat.ToString(), Description = mandat.PorteeDesTravaux, Titre = mandat.TitreMandat, Fonction = fonction, Projet = projet, Taches = mandat.Taches.Select(x => tacheGraphRepository.Search(new Tache { Description = x.Description }, true).First()).ToList() }; conseiller.Mandats.Add(mandatModel); mandatGraphRepository.Add(mandatModel); editionObjectGraphRepository.AjouterNoeud(objetAjoute: mandatModel, viewModelProprieteNom: "Mandats", noeudModifie: utilisateur.Conseiller); mandat.GraphId = mandatModel.GraphKey; return(Json(mandat)); }
public ActionResult Add(string utilisateurId, [FromBody] List <TechnologieViewModel> technologies) { try { foreach (var technologie in technologies) { var utilisateur = utilisateurGraphRepository.GetOne(utilisateurId); var _technologies = utilisateur.Conseiller.Technologies; if (_technologies.Any(x => x.GraphKey == technologie.GraphId)) { continue; } if (utilisateur.Conseiller.EditionObjects.Any(x => x.ObjetAjoute?.GraphKey == technologie.GraphId)) { continue; } var technologieModel = technologieGraphRepository.GetOne(technologie.GraphId); technologieModel.MoisDExperience = technologie.Mois; editionObjectGraphRepository.AjouterNoeud( objetAjoute: technologieModel, viewModelProprieteNom: "Technologies", noeudModifie: utilisateur.Conseiller); technologie.GraphId = technologieModel.GraphKey; } return(Json(new { ok = true })); } catch (Exception ex) { return(null); } }