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, })); }
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, })); }
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)); }