public MainPageCategory(int categoryId = 0)
        {
            InitializeComponent();
            NavigationPage.SetHasNavigationBar(this, false);
            categoryglobalId = categoryId;
            InformationContentProvider informationContentProvider = new InformationContentProvider();

            //Todo:Dön burada appuserId yok
            InformationContentPostModel postModel = new InformationContentPostModel()
            {
                TokenKey   = TokenAccesModel.accesValue,
                CategoryId = categoryId,
                AppUserId  = 0
            };
            ///sayfaya yönlendir devam et

            InfrastructureModel <InformationContentSingleDataModel> informationContentSingleDataModelList = new InfrastructureModel <InformationContentSingleDataModel>();

            informationContentSingleDataModelList = informationContentProvider.GetInformationCategoryContentSingleData(postModel);

            lblExplanation.Text = informationContentSingleDataModelList.ResultModel.Explanation;
            lblTitle.Text       = informationContentSingleDataModelList.ResultModel.Title;
            imgContent.Source   = informationContentSingleDataModelList.ResultModel.ImagePath;

            btnChangeSingleData.Clicked += BtnChangeSingleData_Clicked;
        }
        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));
        }
        public IActionResult Index()
        {
            informationContentProvider = new InformationContentProvider();

            InfrastructureModel <List <InformationContentSingleDataModel> > infrastructureModelList = informationContentProvider.GetListInformationContent(SessionExtension.GetSessionUserTokeyKey(HttpContext.Session));

            return(View(infrastructureModelList));
        }
        public JsonResult Insert(InformationContentCRUDModel informationContentCRUDModel)
        {
            Response response = new Response();

            try
            {
                informationContentProvider = new InformationContentProvider();

                AppUserModel appUserModel = SessionExtension.GetSessionUser(HttpContext.Session);

                InformationApiContentCRUDModel apiContentCRUDModel = new InformationApiContentCRUDModel()
                {
                    CategoryId  = informationContentCRUDModel.CategoryId,
                    Explanation = informationContentCRUDModel.Explanation,
                    Title       = informationContentCRUDModel.Title,
                    LikeCount   = 0,
                    AuthorId    = appUserModel.AppUser.AppUserId,
                    TokenKey    = appUserModel.TokenKey
                };


                if (informationContentCRUDModel.InformationImage != null)
                {
                    byte[] data;
                    using (var ms = new MemoryStream())
                    {
                        informationContentCRUDModel.InformationImage.CopyTo(ms);
                        apiContentCRUDModel.PostImagePath = Path.GetExtension(informationContentCRUDModel.InformationImage.FileName);
                        data = ms.ToArray();
                    }

                    var fileContent = new ByteArrayContent(data);

                    apiContentCRUDModel.ImageArrayList = fileContent;

                    informationContentProvider.InsertInformationContent(apiContentCRUDModel);
                }
                response = new Response()
                {
                    Message = "success",
                    Status  = true,
                };
            }
            catch (Exception ex)
            {
                response = new Response()
                {
                    Message = "Failed",
                    Status  = false
                };
            }

            return(Json(response));
        }
Esempio n. 5
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;
        }
        private async void BtnChangeSingleData_Clicked(object sender, EventArgs e)
        {
            InformationContentProvider informationContentProvider = new InformationContentProvider();

            //Todo:Dön burada appuserId yok
            InformationContentPostModel postModel = new InformationContentPostModel()
            {
                TokenKey   = TokenAccesModel.accesValue,
                CategoryId = categoryglobalId,
                AppUserId  = 0
            };
            ///sayfaya yönlendir devam et

            InfrastructureModel <InformationContentSingleDataModel> informationContentSingleDataModelList = new InfrastructureModel <InformationContentSingleDataModel>();

            informationContentSingleDataModelList = informationContentProvider.GetInformationCategoryContentSingleData(postModel);

            lblExplanation.Text = informationContentSingleDataModelList.ResultModel.Explanation;
            lblTitle.Text       = informationContentSingleDataModelList.ResultModel.Title;
            imgContent.Source   = informationContentSingleDataModelList.ResultModel.ImagePath;
        }
 public HomeController(ILogger <HomeController> logger)
 {
     informationContentProvider = new InformationContentProvider();
     _logger = logger;
 }