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;
        }
示例#2
0
        public JsonResult GetCategorySingleContent(InformationContentPostModel model)
        {
            try
            {
                InfrastructureModel <InformationContentSingleDataModel> response = new InfrastructureModel <InformationContentSingleDataModel>();
                InformationContentSingleDataModel resultModel = new InformationContentSingleDataModel();
                try
                {
                    InformationContent informationContext = informationContentOperation.GetCategorySingleInformationContent(model.AppUserId, model.CategoryId);
                    resultModel.AuthorFullName = informationContext.Author.Name + " " + informationContext.Author.Surname;
                    resultModel.Explanation    = informationContext.Explanation;
                    resultModel.ImagePath      = informationContext.PostImagePath;
                    resultModel.LikeCount      = informationContext.LikeCount.ToString();
                    resultModel.Title          = informationContext.Title;

                    response.ResultModel  = resultModel;
                    response.ResultStatus = true;
                }
                catch (Exception ex)
                {
                    response.ResultStatus = false;
                    throw ex;
                }
                return(new JsonResult(response));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        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;
        }
示例#4
0
        public InfrastructureModel <InformationContentSingleDataModel> GetInformationCategoryContentSingleData(InformationContentPostModel postModel)
        {
            InfrastructureModel <InformationContentSingleDataModel> resultModel = new InfrastructureModel <InformationContentSingleDataModel>();

            using (HttpClient client = new HttpClient())
            {
                client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", postModel.TokenKey);
                client.DefaultRequestHeaders.TryAddWithoutValidation("Content-Type", "application/json charset=utf-8");
                client.DefaultRequestHeaders.Accept.Clear();

                var           serializeJsonObject = JsonConvert.SerializeObject(postModel);
                StringContent content             = new StringContent(serializeJsonObject, Encoding.UTF8, "application/json");


                HttpResponseMessage httpResponceMessage = client.PostAsync(ConnectionHelper.GetConnectionUrl() + "Information/GetCategorySingleContent/", content).Result;
                httpResponceMessage.EnsureSuccessStatusCode();

                string response = httpResponceMessage.Content.ReadAsStringAsync().Result;

                resultModel = JsonConvert.DeserializeObject <InfrastructureModel <InformationContentSingleDataModel> >(response);

                return(resultModel);
            }
        }
示例#5
0
        public JsonResult GetSingleContent(InformationContentPostModel informationContentPostModel)
        {
            InfrastructureModel <InformationContentSingleDataModel> response = new InfrastructureModel <InformationContentSingleDataModel>();
            InformationContentSingleDataModel resultModel = new InformationContentSingleDataModel();

            try
            {
                InformationContent informationContext = informationContentOperation.GetSingleInformationContent(informationContentPostModel.AppUserId);
                if (informationContext != null)
                {
                    resultModel.AuthorFullName = informationContext.Author != null?informationContext.Author.Name + " " + informationContext.Author.Surname:"Eski Sevgilim :)";
                    resultModel.Explanation    = informationContext.Explanation;
                    resultModel.ImagePath      = UrlHelper.InformationPhotoPath + "/" + informationContext.PostImagePath;
                    resultModel.LikeCount      = informationContext.LikeCount.ToString();
                    resultModel.Title          = informationContext.Title;

                    for (int i = 0; i <= 4; i++)
                    {
                        Random rnd         = new Random();
                        Color  randomColor = Color.FromArgb(rnd.Next(256), rnd.Next(256), rnd.Next(256));


                        if (i == 1)
                        {
                            resultModel.ColorCode1 = "#" + randomColor.R.ToString("X2") + randomColor.G.ToString("X2") + randomColor.B.ToString("X2");
                        }
                        if (i == 2)
                        {
                            resultModel.ColorCode2 = "#" + randomColor.R.ToString("X2") + randomColor.G.ToString("X2") + randomColor.B.ToString("X2");
                        }

                        if (i == 3)
                        {
                            resultModel.ColorCode3 = "#" + randomColor.R.ToString("X2") + randomColor.G.ToString("X2") + randomColor.B.ToString("X2");
                        }

                        if (i == 4)
                        {
                            resultModel.ColorCode4 = "#" + randomColor.R.ToString("X2") + randomColor.G.ToString("X2") + randomColor.B.ToString("X2");
                        }

                        response.ResultModel           = resultModel;
                        response.ResultModel.IsAllView = false;
                        response.ResultStatus          = true;
                    }
                }
                else
                {
                    response.ResultModel           = resultModel;
                    response.ResultModel.IsAllView = true;
                    resultModel.ImagePath          = UrlHelper.InformationPhotoPath + "/" + "33350e5ae-56d8-4707-ac40-8b4c60ddb115.jpg";
                    resultModel.Title       = "Tüm İçerikleri Gördünüz";
                    resultModel.Explanation = "Bunları biliyor musunuz ? takipçileri içerik bittiğinde görüyorsa bir yöneticiye mail gitmiştir ve sizin için yeni içerik oluşturma talebi oluşur";
                    response.ResultStatus   = true;
                }
            }
            catch (Exception ex)
            {
                response.ResultStatus = false;
                throw ex;
            }
            return(new JsonResult(response));
        }