Example #1
0
        public async Task <List <Comment> > GetCommentsForPhotoAsync(int photoId)
        {
            GetCommentsForPhotosReply resp = await commentsThingClient.GetCommentsForPhotoAsync(new GetCommentsForPhotosRequest()
            {
                PhotoId = photoId
            });

            return(resp.Comments.Select(c => c.ToComment()).ToList());
        }
Example #2
0
        public async Task <List <Comment> > GetCommentsForPhotoAsync(int photoId)
        {
            GetCommentsForPhotosReply resp = await serviceClient.GetCommentsForPhotoAsync(new GetCommentsForPhotosRequest()
            {
                PhotoId = photoId
            });

            return(resp.Comments.Select(c => new Comment {
                Id = c.Id, PhotoId = c.PhotoId, UserName = c.UserName, Subject = c.Subject, Body = c.Body, SubmittedOn = c.SubmittedOn.ToDateTime()
            }).ToList());
        }
Example #3
0
        public override async Task <GetCommentsForPhotosReply> GetCommentsForPhoto(GetCommentsForPhotosRequest request, ServerCallContext context)
        {
            List <Comment> comments = await commentsService.GetCommentsForPhotoAsync(request.PhotoId);

            var r = new GetCommentsForPhotosReply();

            r.Comments.AddRange(comments.Select(co => new GetCommentsForPhotosReplyItem()
            {
                Id = co.Id, PhotoId = co.PhotoId, Subject = co.Subject, UserName = co.UserName, Body = co.Body, SubmittedOn = Google.Protobuf.WellKnownTypes.Timestamp.FromDateTime(co.SubmittedOn.ToUniversalTime())
            }));
            return(r);
        }