Ejemplo n.º 1
0
        public List <ReferralDTO> ReferralsByPostId(int postId)
        {
            List <ReferralDTO>           referralsForPost = new List <ReferralDTO>();
            List <Model.Entity.Referral> referrals        = _referralRepository.GetMany(p => p.PostID == postId).ToList();

            foreach (Model.Entity.Referral referral in referrals)
            {
                referralsForPost.Add(new ReferralDTO
                {
                    ReferralID          = referral.ReferralID,
                    PostID              = referral.PostID,
                    Subject             = referral.Subject,
                    Message             = referral.Message,
                    CreatedBy           = referral.CreatedBy,
                    CreatedByUserDetail = new UserDTO()
                    {
                        FirstName    = referral.User.FirstName,
                        MiddleName   = referral.User.MiddleName,
                        LastName     = referral.User.LastName,
                        EmailAddress = referral.User.EmailAddress,
                        Mobile       = referral.User.Mobile
                    },
                    CreatedOn = referral.CreatedOn
                });
            }
            return(referralsForPost);
        }