using GanjooRazor.Models.MuseumLink;
using GanjooRazor.Utils;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Newtonsoft.Json;
using RMuseum.Models.GanjoorIntegration.ViewModels;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
namespace GanjooRazor.Pages
{
[IgnoreAntiforgeryToken(Order = 1001)]
public class PinModel : PageModel
{
///
ورود به گنجور";
}
else
if (Request.Query["final"] == "1")
{
using (HttpClient secureClient = new HttpClient())
{
if(await GanjoorSessionChecker.PrepareClient(secureClient, Request, Response))
{
PinterestLinkViewModel model = new PinterestLinkViewModel()
{
GanjoorPostId = RelatedImageSuggestionModel.PoemId,
GanjoorUrl = $"https://ganjoor.net{RelatedImageSuggestionModel.GanjoorUrl}",
GanjoorTitle = RelatedImageSuggestionModel.GanjoorTitle,
AltText = RelatedImageSuggestionModel.AltText,
LinkType = RMuseum.Models.GanjoorIntegration.LinkType.Pinterest,
PinterestUrl = RelatedImageSuggestionModel.PinterestUrl,
PinterestImageUrl = RelatedImageSuggestionModel.PinterestImageUrl
};
var stringContent = new StringContent(JsonConvert.SerializeObject(model), Encoding.UTF8, "application/json");
var response = await secureClient.PostAsync($"{APIRoot.Url}/api/artifacts/pinterest", stringContent);
if (response.StatusCode != HttpStatusCode.OK)
{
LastError = JsonConvert.DeserializeObject