Ejemplo n.º 1
0
 public static PhotoComment ToPhotoComment(this PhotoCommentPO po)
 {
     PhotoComment result = new PhotoComment();
     result.Id = po.Id;
     result.PhotoId = po.PhotoId;
     result.AlbumId = po.AlbumId;
     result.Contents = po.Contents;
     result.CreatedBy = po.CreatedBy;
     result.CreatedOn = po.CreatedOn;
     return result;
 }
Ejemplo n.º 2
0
        void PostComment(string contents)
        {
            if (IsLoadingComments)
                return;

            CanPostComment = false;
            PhotoComment comment = new PhotoComment();
            comment.Contents = contents;
            comment.CreatedBy = SecurityContext.Current.User.Name;
            comment.PhotoId = Id;
            comment.AlbumId = AlbumId;
            PhotoServiceClient svc = new PhotoServiceClient();
            try
            {
                svc.CreateCommentCompleted += (sender, e) =>
                {
                    if (e.Error != null)
                    {
                        e.Error.Handle();
                    }
                    else
                    {
                        if (_comments != null)
                        {
                            _comments.Insert(0, MapToPhotoCommentViewModel(e.Result));
                        }
                    }
                    CanPostComment = true;
                    CommentContents = string.Empty;
                    NotifyOfPropertyChange(() => HasComment);
                };
                svc.CreateCommentAsync(comment);
            }
            catch
            {
                CanPostComment = true;
            }
        }
Ejemplo n.º 3
0
 PhotoCommentViewModel MapToPhotoCommentViewModel(PhotoComment photoComment)
 {
     return new PhotoCommentViewModel()
     {
         Id = photoComment.Id,
         CreatedBy = photoComment.CreatedBy,
         CreatedOn = photoComment.CreatedOn,
         Contents = photoComment.Contents
     };
 }
Ejemplo n.º 4
0
 public PhotoComment CreateComment(PhotoComment comment)
 {
     PhotoComment result = null;
     ServiceSupport.AuthorizeAndExecute(() =>
         {
             result = PhotoRepository.CreateComment(comment);
         });
     return result;
 }