예제 #1
0
        public FeedFineModel MapToFeedModelWithPayment(Fine fine, User issuer, User receiver, Payment payment)
        {
            FeedFineModel fineModel = new FeedFineModel {
                Id = fine.Id,
                IssuerId = fine.IssuerId,
                Reason = fine.Reason,
                SeconderId = fine.SeconderId,
                Pending = fine.Pending,
                AwardedDate = fine.AwardedDate,
                IssuerDisplayName = issuer.DisplayName,
                ReceiverDisplayName = receiver.DisplayName,
                ReceiverId = receiver.Id,
                ModifiedDate = fine.ModifiedDate,
                UserImage = receiver.Image,
                Platform = fine.Platform.GetDescription()
            };

            if(payment != null)
            {
                fineModel.PaidDate = payment.PaidDate;
                fineModel.PayerId = payment.PayerId;
                fineModel.PaymentImage = payment.PaymentImage.ImageBytes.ToString();
            }

            return fineModel;
        }
 public void BuildNewFineFeedModelFromExistingModel(FeedFineModel feedFineModel)
 {
     this.Id = feedFineModel.Id;
     this.IssuerId = feedFineModel.IssuerId;
     this.Reason = feedFineModel.Reason;
     this.SeconderId = feedFineModel.SeconderId;
     this.Seconder = feedFineModel.Seconder;
     this.Pending = feedFineModel.Pending;
     this.AwardedDate = feedFineModel.AwardedDate;
     this.IssuerDisplayName = feedFineModel.IssuerDisplayName;
     this.ReceiverDisplayName = feedFineModel.ReceiverDisplayName;
     this.PaidDate = null;
     this.PayerId = null;
     this.PaymentImage = feedFineModel.PaymentImage ?? "content/defaultUser.png";
     this.ModifiedDate = feedFineModel.AwardedDate;
     this.UserImage = feedFineModel.UserImage;
     this.TotalPaid = feedFineModel.TotalPaid;
 }