warrenchen 75e235b8e3 Add admin area controllers and views for managing OAuth clients, security settings, subscriptions, and tenants
- Implemented OAuthClientsController for CRUD operations on OAuth clients.
- Added SecurityController to manage security settings.
- Created SubscriptionsController for handling subscriptions with export functionality.
- Developed TenantsController for tenant management including create, edit, and delete operations.
- Added views for each controller to facilitate user interaction.
- Introduced layout and shared views for consistent admin UI.
- Implemented model classes for handling data in views.
- Added validation and error handling in forms.
2026-04-01 17:40:45 +09:00

40 lines
1017 B
C#

using MemberCenter.Application.Abstractions;
using MemberCenter.Application.Models.Admin;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace MemberCenter.Web.Areas.Admin.Controllers;
[Area("Admin")]
[Authorize(Policy = "Admin")]
[Route("admin/security")]
public class SecurityController : Controller
{
private readonly ISecuritySettingsService _settingsService;
public SecurityController(ISecuritySettingsService settingsService)
{
_settingsService = settingsService;
}
[HttpGet("")]
public async Task<IActionResult> Index()
{
var settings = await _settingsService.GetAsync();
return View(settings);
}
[HttpPost("")]
public async Task<IActionResult> Save(SecuritySettingsDto model)
{
if (!ModelState.IsValid)
{
return View("Index", model);
}
await _settingsService.SaveAsync(model);
ViewData["Result"] = "Saved";
return View("Index", model);
}
}