void IRegistrationRepository.CreateAffiliationReferral(AffiliationReferral affiliationReferral) { using (var dc = CreateContext()) { dc.JoinReferralEntities.InsertOnSubmit(affiliationReferral.Map()); dc.SubmitChanges(); } }
public static JoinReferralEntity Map(this AffiliationReferral affiliationReferral) { return(new JoinReferralEntity { userId = affiliationReferral.RefereeId, promotionCode = affiliationReferral.PromotionCode, refererUrl = affiliationReferral.RefererUrl, referralCode = affiliationReferral.ReferralCode, }); }
private void CreateReferral(HttpCookieCollection cookies, Guid userId) { var pcode = cookies.GetCookieValue(PromoCodeCookie); var refcode = cookies.GetCookieValue(ReferrerCodeCookie); var refererUrl = cookies.GetCookieValue(ReferrerUrlCookie); if (string.IsNullOrEmpty(pcode) && string.IsNullOrEmpty(refcode) && string.IsNullOrEmpty(refererUrl)) { return; } var referral = new AffiliationReferral { RefereeId = userId, PromotionCode = pcode, ReferralCode = refcode, RefererUrl = refererUrl }; _referralsCommand.CreateAffiliationReferral(referral); }
void IReferralsCommand.CreateAffiliationReferral(AffiliationReferral affiliationReferral) { affiliationReferral.Prepare(); affiliationReferral.Validate(); _repository.CreateAffiliationReferral(affiliationReferral); }