public HttpResponseMessage GetById(int Id) { var result = organizerService.GetById(Id); //OrganizerModel organizerModel = organizerService.GetById(id); return(Request.CreateResponse(HttpStatusCode.OK, result)); }
//-------------------------------------------------------------------------------------------------------------- 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 }); }
//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 ActionResult IndexTache() { test = Int32.Parse(User.Identity.GetUserId()); Os = new OrganizerService(); Ts = new TacheService(); ViewBag.myid = ""; var currentUserId = Int32.Parse(User.Identity.GetUserId()); // ViewBag.myid = currentUserId; if (Ts.Matache(currentUserId) == true) { ViewBag.myid = true; } else { ViewBag.myid = false; } List <TacheModelView> lists = new List <TacheModelView>(); List <Tache> liststache = new List <Tache>(); liststache = Ts.GetAll().Where(x => x.IsDeleted == false).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); } var orgservice = Os.ListOrganizers(); List <OrganizerModelView> lorg = new List <OrganizerModelView>(); foreach (var item in orgservice) { OrganizerModelView org = new OrganizerModelView(); org.Id = item.Id; org.FirstName = item.FirstName; org.LastName = item.LastName; org.Password = item.Password; org.Email = item.Email; org.EmailConfirmed = item.EmailConfirmed; org.PasswordHash = item.PasswordHash; org.PhoneNumber = item.PhoneNumber; org.PhoneNumberConfirmed = item.PhoneNumberConfirmed; org.TwoFactorEnabled = item.TwoFactorEnabled; org.LockoutEndDateUtc = item.LockoutEndDateUtc; org.LockoutEnabled = item.LockoutEnabled; org.AccessFailedCount = item.AccessFailedCount; org.UserName = item.UserName; // org.Roles = item.Roles; org.SecurityStamp = item.SecurityStamp; lorg.Add(org); } // ViewData["Organ"] = new SelectList(lorg, "Id", "FirstName"); ViewData["Organ"] = new SelectList(lorg, "Id", "FirstName"); ViewBag.OrganisateurList = new SelectList(lorg, "Id", "FirstName"); ViewBag.TacheList = lists; //CustomersEntities entities = new CustomersEntities(); return(View()); }