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); } }
public List <TacheView> GetAll() { List <TacheView> listeTaches = TacheTools.listTolistView(_unitOfWork.TacheRepository.Get(null, null, _includeTache).ToList()); return(listeTaches); }
public List <TacheView> OrderByPriorite() { List <TacheView> listeTaches = TacheTools.listTolistView(_unitOfWork.TacheRepository.Get(null, null, _includeTache).ToList()); return(listeTaches.OrderByDescending(x => x.Priorite.Niveau).ToList()); }
// parametre, Guid idTache public TacheView Get(Guid idTache) { TacheView tacheTest = TacheTools.TacheToTacheV(_unitOfWork.TacheRepository.GetById(idTache, _includeTache)); return(tacheTest); }