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); }
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; }
public void Save(Contact contact) { _table.AddOrUpdate(contact); }
public void Delete(Contact contact) { _table.Delete(contact); }
private void StoreContact(Contact _contact) { SQLContacts.Contacts.Add(MapContactToSqlContact(_contact)); SQLContacts.SaveChanges(); Trace.TraceInformation("Contact saved to SQL- " + _contact.Email); }
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; }