Beispiel #1
0
        static object GetRoom(
            NancyContext context,
            IDocumentSession documentSession,
            string slug)
        {
            context.Ensure("context");
            documentSession.Ensure("documentSession");

            if (string.IsNullOrEmpty(slug))
                return 404;

            if (!context.IsSignedUp())
                return 403;

            var room = documentSession.GetRoomBySlug(slug);
            if (room == null)
                return 404;

            var currentMember = context.GetCurrentMember(documentSession);
            Debug.Assert(currentMember != null, "`requireSignedUp()` should ensure a current member.");

            var posts = documentSession.GetPostsByRoom(room.Id).ToArray();

            return new RoomResponse(currentMember, room, posts);
        }