#165 download poet sqlite database from UI
This commit is contained in:
parent
42465d484a
commit
dc58904e6c
@ -100,7 +100,13 @@
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<a role="button" href="/Admin/PoetDel/?id=@Model.Poet.Id" class="actionlink">حذف شاعر</a>
|
||||
<td><a role="button" href="/Admin/Poet/?Handler=DownloadSqliteDb&id=@Model.Poet.Id" class="actionlink">sqlite</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td><a role="button" href="/Admin/PoetDel/?id=@Model.Poet.Id" class="actionlink">حذف شاعر</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
@ -10,6 +10,7 @@ using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
using Newtonsoft.Json;
|
||||
using RMuseum.Models.Ganjoor.ViewModels;
|
||||
using RMuseum.Services.Implementation.ImportedFromDesktopGanjoor;
|
||||
|
||||
namespace GanjooRazor.Areas.Admin.Pages
|
||||
{
|
||||
@ -234,5 +235,21 @@ namespace GanjooRazor.Areas.Admin.Pages
|
||||
|
||||
return Page();
|
||||
}
|
||||
|
||||
public async Task<IActionResult> OnGetDownloadSqliteDbAsync(int id)
|
||||
{
|
||||
using (HttpClient secureClient = new HttpClient())
|
||||
{
|
||||
LastResult = "";
|
||||
await PreparePoet();
|
||||
|
||||
await GanjoorSessionChecker.PrepareClient(secureClient, Request, Response);
|
||||
|
||||
var content = await secureClient.GetStreamAsync($"{APIRoot.Url}/api/ganjoor/sqlite/export/{id}");
|
||||
var contentType = "Application/octet-stream";
|
||||
var fileName = $"{GPersianTextSync.Farglisize(Poet.Name)}.gdb";
|
||||
return File(content, contentType, fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user