コード例 #1
0
        private void SendTasks()
        {
            var taskRepo = new TasksRepository(_connectionString);
            var tasks    = taskRepo.GetActiveTasks();

            Clients.All.SendAsync("RenderTasks", tasks.Select(t => new
            {
                Id          = t.Id,
                Title       = t.Title,
                HandledBy   = t.HandledBy,
                UserDoingIt = t.User != null ? $"{t.User.FirstName} {t.User.LastName}" : null,
            }));
        }
コード例 #2
0
ファイル: TasksHub.cs プロジェクト: LIT-W05/RealTimeTasks
        private void SendTasks()
        {
            var taskRepo = new TasksRepository(Properties.Settings.Default.ConStr);
            var tasks    = taskRepo.GetActiveTasks();

            Clients.All.renderTasks(tasks.Select(t => new
            {
                Id          = t.Id,
                Title       = t.Title,
                HandledBy   = t.HandledBy,
                UserDoingIt = t.User != null ? $"{t.User.FirstName} {t.User.LastName}" : null,
            }));
        }
コード例 #3
0
        public ActionResult GetTasks()
        {
            var repo = new TasksRepository(Properties.Settings.Default.ConStr);

            return(Json(repo.GetActiveTasks().Select(t =>
            {
                return new
                {
                    Id = t.Id,
                    Title = t.Title,
                    HandledBy = t.HandledBy,
                    User = new
                    {
                        FirstName = t.User.FirstName,
                        LastName = t.User.LastName,
                        Email = t.User.EmailAddress
                    }
                };
            }), JsonRequestBehavior.AllowGet));
        }