Exemplo n.º 1
0
        public UserRegistrationRequest GetUser(Guid userId)
        {
            var db = new GloshareContext();

            var mobileLead = db.MobilelLeads.FirstOrDefault(m => m.UserId == userId);

            return(MobileLeadMapper.Map(mobileLead));
        }
Exemplo n.º 2
0
        public void Register(int mobileLeadId, UserRegistrationRequest userRegistrationRequest)
        {
            var db         = new GloshareContext();
            var mobileLead = db.MobilelLeads.Find(mobileLeadId);

            MobileLeadMapper.Map(userRegistrationRequest, mobileLead);

            db.SaveChanges();
        }
Exemplo n.º 3
0
        public int?Register(Guid userId, UserRegistrationRequest userRegistrationRequest)
        {
            var db         = new GloshareContext();
            var mobileLead = db.MobilelLeads.FirstOrDefault(m => m.UserId == userId);

            MobileLeadMapper.Map(userRegistrationRequest, mobileLead);

            db.SaveChanges();

            var oil = db.OptInLeads.Where(o => o.EmailAddress == mobileLead.EmailAddress);

            int?birthdayDay   = null;
            int?birthdayMonth = null;
            int?birthdayYear  = null;

            if (mobileLead.Dob.HasValue)
            {
                birthdayDay   = mobileLead.Dob.Value.Day;
                birthdayMonth = mobileLead.Dob.Value.Month;
                birthdayYear  = mobileLead.Dob.Value.Year;
            }

            foreach (OptInLead lead in  oil)
            {
                lead.Firstname     = lead.Firstname ?? mobileLead?.Firstname;
                lead.Lastname      = lead.Lastname ?? mobileLead?.Lastname;
                lead.Address       = lead.Address ?? mobileLead?.Address;
                lead.BirthdayDay   = lead.BirthdayDay ?? birthdayDay;
                lead.BirthdayMonth = lead.BirthdayMonth ?? birthdayMonth;
                lead.BirthdayYear  = lead.BirthdayYear ?? birthdayYear;
                lead.City          = lead.City ?? mobileLead?.City;
                lead.State         = lead.State ?? mobileLead?.State;
                lead.Zip           = lead.Zip ?? mobileLead?.Zip;
            }

            db.SaveChanges();

            return(mobileLead.RouterContactId);
        }