public ActionResult Index(string _signedRequest)
        {
            dynamic response = GetFacebookUserData(_signedRequest);
            if (response == null)
                return new RedirectResult("/");

            Contact contact = new Contact();
            contact.FirstName = response.first_name;
            contact.LastName = response.last_name;
            contact.DateOfBirth = DateTime.Parse(response.birthday);
            contact.Email = response.email;

            StateData stateData = new StateData();
            stateData.FBSignedRequest = _signedRequest;
            stateData.FBUserId = response.id;

            ContactInfoViewModel model = new ContactInfoViewModel();
            model.contact = contact;
            model.state = stateData;

            if (contactRepository.IsRegistered(response.id))
                return RedirectToAction("RegisterComplete");
            else
                return View(model);
        }
Esempio n. 2
0
        public SQLContact MapContactToSqlContact(Contact contact)
        {
            SQLContact sqlContact = new SQLContact();

            sqlContact.FirstName = contact.FirstName;
            sqlContact.LastName = contact.LastName;
            sqlContact.DateOfBirth = contact.DateOfBirth;
            sqlContact.Email = contact.Email;
            sqlContact.Zip = contact.Zip;
            sqlContact.StoreNumber = Convert.ToInt32(contact.StoreNumber);
            sqlContact.Registered = contact.Registered;
            sqlContact.FacebookId = contact.PartitionKey;

            return sqlContact;
        }
Esempio n. 3
0
 public void Save(Contact contact)
 {
     _table.AddOrUpdate(contact);
 }
Esempio n. 4
0
 public void Delete(Contact contact)
 {
     _table.Delete(contact);
 }
Esempio n. 5
0
 private void StoreContact(Contact _contact)
 {
     SQLContacts.Contacts.Add(MapContactToSqlContact(_contact));
     SQLContacts.SaveChanges();
     Trace.TraceInformation("Contact saved to SQL- " + _contact.Email);
 }
Esempio n. 6
0
 private void SendEmail(Contact _contact)
 {
     // contact another service to send off the email with the premium coupon here (outside the scope of this sample)
     Trace.TraceInformation("SAMPLE: Coupon email not implemented. Test address:" + _contact.Email);
 }
 private void QueueContact(Contact contact)
 {
     // queue the contact for the worker role.
     ContactQueueMessage message = new ContactQueueMessage();
     message.FacebookId = contact.PartitionKey;
     contactQueue.AddMessage(message);
 }
 private bool AlreadyRegistered(Contact contact)
 {
     return (contact != null) && contact.Registered;
 }