mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-02 15:11:10 +00:00
Implements first stage library management system
This commit is contained in:
1 parent
5e0f94cd82
commit
36352ea9e8
291 files changed
+3733
-1384
No files matched your search
+50
@@ -0,0 +1,50 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Presentation.Web.Common.Api;
|
||||
using Lumina.Presentation.Web.Common.Enums.Library;
|
||||
using Lumina.Presentation.Web.Common.Models.Libraries;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Formatters;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Controllers.Library.Management;
|
||||
|
||||
[Route("/library/manage/")]
|
||||
public class LibraryManagementController : Controller
|
||||
{
|
||||
private readonly IApiHttpClient _apiHttpClient;
|
||||
|
||||
public LibraryManagementController(IApiHttpClient apiHttpClient)
|
||||
{
|
||||
_apiHttpClient = apiHttpClient;
|
||||
}
|
||||
|
||||
[HttpGet("")]
|
||||
public IActionResult Index()
|
||||
{
|
||||
return View("/Views/Library/Management/Index.cshtml");
|
||||
}
|
||||
|
||||
[HttpGet("item/{id?}")]
|
||||
public IActionResult EditLibrary(Guid? id = null)
|
||||
{
|
||||
LibraryModel libraryModel = new()
|
||||
{
|
||||
Id = id,
|
||||
LibraryType = LibraryType.Book,
|
||||
Paths = ["a", "b", "c"],
|
||||
Title = ""
|
||||
};
|
||||
return View("/Views/Library/Management/Item.cshtml", libraryModel);
|
||||
}
|
||||
|
||||
[HttpPost("item")]
|
||||
public async Task<IActionResult> SaveLibraryAsync([FromBody] LibraryModel model)
|
||||
{
|
||||
LibraryModel response = model.Id.HasValue
|
||||
? await _apiHttpClient.PutAsync<LibraryModel, LibraryModel>($"libraries/{model.Id}", model)
|
||||
: await _apiHttpClient.PostAsync<LibraryModel, LibraryModel>("libraries", model);
|
||||
return Json(new { success = true });
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user