public JsonResult GetNotification() { ViewBag.myid = "test"; Ts = new TacheService(); Os = new OrganizerService(); List <TacheModelView> list = new List <TacheModelView>(); List <Tache> liststache = new List <Tache>(); var currentUserId = Int32.Parse(User.Identity.GetUserId()); liststache = Ts.Listedemestaches(currentUserId).ToList(); // List<Tache> liststache = new List<Tache>(); var notificationRegisterTime = Session["LastUpdated"] != null?Convert.ToDateTime(Session["LastUpdated"]) : DateTime.Now; // NC = new NotificationComponent(); foreach (var item in liststache) { 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); list.Add(dvm); } //list = NC.GetContacts(notificationRegisterTime); //update session here for get only new added contacts (notification) Session["LastUpdate"] = DateTime.Now; return(Json(list, JsonRequestBehavior.AllowGet)); }
//public JsonResult GetNotificationContacts() //{ // var notificationRegisterTime = Session["LastUpdated"] != null ? Convert.ToDateTime(Session["LastUpdated"]) : DateTime.Now; // NotificationViewModel NC = new NotificationViewModel(); // var list = NC.GetAllThetasksnotif(notificationRegisterTime); // //update session here for get only new added contacts (notification) // Session["LastUpdate"] = DateTime.Now; // return new JsonResult { Data = list, JsonRequestBehavior = JsonRequestBehavior.AllowGet }; //} public ActionResult GetMyTasks() { Os = new OrganizerService(); Ts = new TacheService(); var currentUserId = Int32.Parse(User.Identity.GetUserId()); List <TacheModelView> lists = new List <TacheModelView>(); List <Tache> liststache = new List <Tache>(); liststache = Ts.Listedemestaches(currentUserId).ToList(); foreach (var item in liststache) { 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); } ViewBag.TacheList = lists; return(View(lists)); }
public IQueryable <Tache> GetMyTache(int Id) { List <Tache> taches = ts.Listedemestaches(Id).ToList(); return(taches.AsQueryable()); }