コード例 #1
0
 public static Tache TacheAjoutToTache(TacheAjout ta)
 {
     return(new Tache()
     {
         Nom = ta.Nom,
         Description = ta.Description,
         DateCreation = DateTime.Now,
         DateDeadline = ta.DateDeadLine
     });
 }
コード例 #2
0
 public string Ajout(TacheAjout tacheajout)
 {
     try
     {
         Utilisateur u = _unitOfWork.UtilisateurRepository.GetById(Guid.Parse("ad70b45f-09a8-4a5a-8e6f-c46a4530befb"), _includeUtilisateur); // Utilisateur : Michael
         Tache       t = TacheTools.TacheAjoutToTache(tacheajout);
         t.Createur   = u;
         t.Priorite   = _unitOfWork.PrioriteRepository.Get(x => x.Nom == tacheajout.Priorite, null, "").FirstOrDefault();
         t.Entreprise = _unitOfWork.EntrepriseRepository.Get(x => x.Nom == tacheajout.Entreprise, null, _includeEntreprise).FirstOrDefault();
         t.TypeTache  = _unitOfWork.TypeTacheRepository.Get(x => x.Nom == tacheajout.Type, null, _includeTypeTache).FirstOrDefault();
         t.Statut     = _unitOfWork.StatutRepository.GetById(Guid.Parse("a3419a76-b03b-4402-9756-5b4207ef7819")); // Statut 'En attente'
         t.Id         = Guid.NewGuid();
         Tache tache = _unitOfWork.TacheRepository.Insert(t);
         _unitOfWork.Save();
         return("OK");
     }
     catch (Exception e)
     {
         return(e.Message);
     }
 }