Ejemplo n.º 1
0
        public JsonResult GetJsonPost()
        {
            informationContentProvider = new InformationContentProvider();
            tokenProvider = new TokenProvider();
            string token = string.Empty;
            InfrastructureModel <InformationContentSingleDataModel> infrastructureModel = new InfrastructureModel <InformationContentSingleDataModel>();

            if (SessionExtension.GetSessionUser(HttpContext.Session) == null)
            {
                token = tokenProvider.GetAnonimToken();
                SessionExtension.Set(HttpContext.Session, "FreeToken", token);
                infrastructureModel = informationContentProvider.GetInformationContentSingleData(new InformationContentPostModel()
                {
                    TokenKey = token
                });
            }
            else
            {
                AppUserModel appUserModel = SessionExtension.GetSessionUser(HttpContext.Session);
                if (appUserModel != null)
                {
                    token = appUserModel.TokenKey;

                    infrastructureModel = informationContentProvider.GetInformationContentSingleData(new InformationContentPostModel()
                    {
                        AppUserId = appUserModel.AppUser.AppUserId, TokenKey = token
                    });
                }
            }
            return(Json(infrastructureModel));
        }
Ejemplo n.º 2
0
        private void BtnChangeSingleData_Clicked(object sender, EventArgs e)
        {
            InformationContentProvider informationContentProvider = new InformationContentProvider();
            int appuserId = Application.Current.Properties["appUserId"] != null ? (int)Application.Current.Properties["appUserId"] : 0;
            var data      = informationContentProvider.GetInformationContentSingleData(new InformationContentPostModel()
            {
                TokenKey = TokenAccesModel.accesValue, AppUserId = appuserId
            });

            lblExplanation.Text  = data.ResultModel.Explanation;
            lblTitle.Text        = data.ResultModel.Title;
            ImgPostSource.Source = data.ResultModel.ImagePath;
            contentPage.BackgroundImageSource = data.ResultModel.ImagePath;
        }