/// <summary> /// Sign-in and get member information with Facebook /// </summary> /// <param name="param">SignIn With Facebook Request Model</param> /// <remarks></remarks> public ProfileResultModel SignInWithFacebook(SignInWithFacebookRequestModel param) { ProfileResultModel result = new ProfileResultModel(); if (!this.ModelState.IsValid) { result.Status = false; result.Message = this.ModelState.Values.Single(v => v.Errors.Count > 0).Errors.FirstOrDefault().ErrorMessage; return(result); } try { MemberBL bl = new MemberBL(); var member = bl.SignInWithFacebookId(param); if (member == null) { result.Status = false; result.Message = "Invalid facebook Id"; } else { var token = IdentityHelper.GenerateToken(member); bl.RegisterToken(token); result.Status = true; result.Message = "Sign-in successfully"; result.Member = member; result.Member.AccessToken = token.Token; } } catch (OrgException oex) { result.Status = false; result.Message = oex.Message; } catch (Exception ex) { result.Status = false; result.Message = AppConfigs.InternalErrorMessage; if (AppConfigs.DebugInternalMessage) { result.InternalMessage = ex.Message; } } return(result); }