Created
February 8, 2018 12:51
-
-
Save tusmester/1a98133c0048dc7df5c58a87e3d9ae66 to your computer and use it in GitHub Desktop.
#sn #mvc #viewmodel #dashboard
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using SenseNet.ContentRepository; | |
using SenseNet.Search; | |
using System.Collections.Generic; | |
using System.Linq; | |
namespace SnWebApplication.Models | |
{ | |
public class DashboardViewModel | |
{ | |
public IEnumerable<TaskViewModel> MyTasks => Content.All | |
.Where(c => c.TypeIs("Task") && (User) c["AssignedTo"] == (User)User.Current).Take(20).AsEnumerable() | |
.Select(t => new TaskViewModel((Task)t.ContentHandler)); | |
public IEnumerable<TaskViewModel> OthersTasks => ContentQuery | |
.Query("+TypeIs:Task -AssignedTo:@@CurrentUser@@ .TOP:20").Nodes.Cast<Task>() | |
.Select(t => new TaskViewModel(t)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment