diff --git a/GanjooRazor/Areas/User/Pages/Editor.cshtml b/GanjooRazor/Areas/User/Pages/Editor.cshtml
index cbdb5b04..26554004 100644
--- a/GanjooRazor/Areas/User/Pages/Editor.cshtml
+++ b/GanjooRazor/Areas/User/Pages/Editor.cshtml
@@ -266,6 +266,38 @@
});
}
+
+
+ function newGeoDateTag(poemId) {
+ var url = '?handler=NewGeoDateTag';
+ var locationId = $('#location').val();
+ var year = $('#year').val();
+ var month = $('#month').val()
+ var day = $('#day').val()
+ $.ajax({
+ type: "POST",
+ url: url,
+ data: {
+ poemId: poemId,
+ locationId: locationId,
+ year: year,
+ month: month,
+ day: day
+ },
+ success: function() {
+ alert('انجام شد.');
+ location.reload();
+ },
+ error: function(e) {
+ if (e.responseText == null)
+ alert(e);
+ else
+ alert(e.responseText);
+ }
+
+ });
+ }
+
@if (!string.IsNullOrEmpty(Model.FatalError))
{
@@ -1072,7 +1104,7 @@ else
@{
foreach (var location in Model.Locations)
{
-
+
}
}
@@ -1081,7 +1113,21 @@ else
-
+
|
@@ -1089,7 +1135,7 @@ else
|
|
- برچسب جدید
+ برچسب جدید
|
@@ -1097,7 +1143,7 @@ else
|
- مکانها
+ مکانها
|
}
diff --git a/GanjooRazor/Areas/User/Pages/Editor.cshtml.cs b/GanjooRazor/Areas/User/Pages/Editor.cshtml.cs
index 5ce2f235..1c8a59aa 100644
--- a/GanjooRazor/Areas/User/Pages/Editor.cshtml.cs
+++ b/GanjooRazor/Areas/User/Pages/Editor.cshtml.cs
@@ -433,6 +433,8 @@ namespace GanjooRazor.Areas.User.Pages
}
}
+
+
public async Task OnGetComputeRhymeAsync(int id)
{
@@ -455,5 +457,39 @@ namespace GanjooRazor.Areas.User.Pages
}
}
+
+ public async Task OnPostNewGeoDateTagAsync(int poemId, int locationId, string year, int month, string day)
+ {
+ using (HttpClient secureClient = new HttpClient())
+ {
+ if (await GanjoorSessionChecker.PrepareClient(secureClient, Request, Response))
+ {
+ HttpResponseMessage response = await secureClient.PostAsync(
+ $"{APIRoot.Url}/api/ganjoor/poem/geotag",
+ new StringContent(JsonConvert.SerializeObject(
+ new PoemGeoDateTag()
+ {
+ PoemId = poemId,
+ LocationId = locationId == 0 ? null : locationId,
+ LunarYear = string.IsNullOrEmpty(year) ? null : int.Parse(year),
+ LunarMonth = month == 0 ? null : month,
+ LunarDay = string.IsNullOrEmpty(day) ? null : int.Parse(day)
+ }
+ ),
+ Encoding.UTF8,
+ "application/json")
+ );
+ if (!response.IsSuccessStatusCode)
+ {
+ return new BadRequestObjectResult(JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync()));
+ }
+ return new OkResult();
+ }
+ else
+ {
+ return new BadRequestObjectResult("لطفا از گنجور خارج و مجددا به آن وارد شوید.");
+ }
+ }
+ }
}
}