Exemple #1
0
        public List <TacheModelView> GetContacts(DateTime afterDate)
        {
            using (ITacheService Ts = new TacheService())
            {
                IOrganizerService     Os        = new OrganizerService();
                List <Tache>          listtache = Ts.GetAll().Where(a => a.DeadlineTache > afterDate).OrderByDescending(a => a.DeadlineTache).ToList();
                List <TacheModelView> lists     = new List <TacheModelView>();
                //  List<Tache> liststache = new List<Tache>();
                // listtache = Ts.GetAll().Where(x => x.IsDeleted == false).ToList();
                foreach (var item in listtache)
                {
                    TacheModelView dvm = new TacheModelView();
                    dvm.IdTache = item.IdTache;
                    dvm.Nom     = (EventManage.Models.NomTache)item.Nom;
                    if (item.DescTache.Length > 50)
                    {
                        var des = item.DescTache.Substring(0, 23) + " ...";
                        dvm.DescTache = des;
                    }
                    else
                    {
                        dvm.DescTache = item.DescTache;
                    }

                    dvm.DeadlineTache = item.DeadlineTache;
                    dvm.EtatdeTache   = (EventManage.Models.EtatTache)item.EtatdeTache;
                    dvm.OrgNom        = Os.GetById(item.OragnisateurFk).FirstName;
                    //dvm.Etat.Equals(item.Etat);
                    lists.Add(dvm);
                }

                return(lists);
            }
        }