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 ActionResult Index(ContactInfoViewModel _model) { if (_model.state.FBSignedRequest == null) return new RedirectResult("/"); dynamic response = GetFacebookUserData(_model.state.FBSignedRequest); _model.contact.PartitionKey = response.id; if (contactRepository.IsRegistered(response.id)) return RedirectToAction("RegisterComplete"); if (ModelState.IsValid) { //save contactRepository.Save(_model.contact); //redirect to selectstore action return RedirectToAction("SelectStore", new { _fbsignedRequest = _model.state.FBSignedRequest, _fbuserid = _model.state.FBUserId}); } return View(_model); }