Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static string GetLatestProjects(SoftUniContext context)
- {
- StringBuilder sb = new StringBuilder();
- var projects = context
- .Projects
- .OrderByDescending(p => p.StartDate)
- .ThenBy(p => p.Name)
- .Select(p => new
- {
- p.Name,
- p.Description,
- p.StartDate
- })
- .Take(10)
- .ToList();
- foreach (var p in projects)
- {
- sb.AppendLine(p.Name);
- sb.AppendLine(p.Description);
- sb.AppendLine(p.StartDate.ToString("M/d/yyyy h:mm:ss tt"));
- }
- return sb.ToString().TrimEnd();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement