Blog.Logic.Core.PostContentsLogic.Get C# (CSharp) Method

Get() public method

public Get ( int postContentId ) : PostContent
postContentId int
return Blog.Common.Contracts.PostContent
        public PostContent Get(int postContentId)
        {
            try
            {
                var db = _postContentRepository.Find(a => a.PostContentId == postContentId, true).FirstOrDefault();

                if (db != null)
                {
                    db.Media.MediaPath = null;
                    db.Media.ThumbnailPath = null;
                    return PostContentMapper.ToDto(db);
                }

                return new PostContent().GenerateError<PostContent>(
                    (int)Constants.Error.RecordNotFound,
                    string.Format("Cannot find post content with Id {0}", postContentId));
            }
            catch (Exception ex)
            {
                throw new BlogException(ex.Message, ex.InnerException);
            }
        }