//-------------------------------------------------------------------------------------------------------------- public JsonResult GetNotificationContacts() { test = Int32.Parse(User.Identity.GetUserId()); //test = 1; //var currentU = Int32.Parse(User.Identity.GetUserId()); //// Ts = new TacheService(); //if (ts.Matache(3) == true) //{ // ViewBag.myid = currentU; //} Ts = new TacheService(); Os = new OrganizerService(); List <TacheModelView> list = new List <TacheModelView>(); List <Tache> liststache = new List <Tache>(); var notificationRegisterTime = Session["LastUpdated"] != null?Convert.ToDateTime(Session["LastUpdated"]) : DateTime.Now; // NC = new NotificationComponent(); var currentUserId = Int32.Parse(User.Identity.GetUserId()); liststache = Ts.gettachenotification(notificationRegisterTime, currentUserId).ToList(); // ViewBag.myid = "test"; 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); } //update session here for get only new added contacts (notification) Session["LastUpdate"] = DateTime.Now; return(new JsonResult { Data = list, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }