Permalink
Browse files

Exposing the users as part of the blog.

NOTE: We are explicitly doing early evaluation of the users collection (via the ToArray call) to keep it inside the same action
  • Loading branch information...
1 parent b694a28 commit d2e15627f20c006bd863499cfcfe1f0930da65c7 @ayende committed Mar 29, 2011
Showing with 10 additions and 1 deletion.
  1. +2 −1 .gitignore
  2. +8 −0 CourseSampleApp/Controllers/HomeController.cs
View
@@ -13,4 +13,5 @@ AssemblyInfo.cs
[Dd]ist
junit-report
junit
-ProfilerMessage.java
+ProfilerMessage.java
+/packages/NHibernateProfiler.1.0.0.820/tools/log.txt
@@ -1,5 +1,6 @@
using System.Web.Mvc;
using CourseSampleApp.Models;
+using System.Linq;
namespace CourseSampleApp.Controllers
{
@@ -15,6 +16,13 @@ public ActionResult Blog(int id)
blog.CreatedAt,
blog.Id,
blog.Subtitle,
+ Users = blog.Users.Select(user => new
+ {
+ user.Id,
+ user.Email,
+ user.Username,
+ user.Bio
+ }).ToArray()
}, JsonRequestBehavior.AllowGet);
}
}

0 comments on commit d2e1562

Please sign in to comment.