Example #1
0
        public Post GetPost(int id)
        {
            PostBDO postBDO = null;

            try
            {
                postBDO = postLogic.GetPost(id);
            }
            catch (Exception e)
            {
                var msg    = e.Message;
                var reason = "GetPost Exception";
                throw new FaultException <PostFault>(new PostFault(msg), reason);
            }

            if (postBDO == null)
            {
                var msg    = string.Format("No post found for id {0}", id);
                var reason = "GetPost Empty Post";
                throw new FaultException <PostFault>(new PostFault(msg), reason);
            }

            var post = new Post();

            TranslatePostBDOToPostDTO(postBDO, post);
            return(post);
        }