change base controllers name - add dates and add admin select List

This commit is contained in:
MahanCh
2025-06-25 15:01:29 +03:30
parent 92f68d8555
commit 1e3780be38
12 changed files with 97 additions and 9 deletions

View File

@@ -0,0 +1,25 @@
using AccountManagement.Application.Contracts.Account;
using Microsoft.AspNetCore.Mvc;
using ServiceHost.BaseControllers;
namespace ServiceHost.Areas.Admin.Controllers;
public class AccountController:AdminBaseController
{
private readonly IAccountApplication _accountApplication;
public AccountController(IAccountApplication accountApplication)
{
_accountApplication = accountApplication;
}
/// <summary>
/// سلکت لیست اکانت های ادمین برای جستجو
/// </summary>
/// <returns></returns>
[HttpGet("select_list")]
public async Task<ActionResult<List<AccountSelectListViewModel>>> GetAdminAccountsSelectList()
{
var res = await _accountApplication.GetAdminSelectList();
return res;
}
}

View File

@@ -3,9 +3,9 @@ using CompanyManagment.App.Contracts.AdminMonthlyOverview;
using Microsoft.AspNetCore.Mvc;
using ServiceHost.BaseControllers;
namespace ServiceHost.Api.Areas.Admin.Controllers;
namespace ServiceHost.Areas.Admin.Controllers;
public class AdminMonthlyOverviewController:AdminController
public class AdminMonthlyOverviewController:AdminBaseController
{
private readonly IAdminMonthlyOverviewApplication _adminMonthlyOverviewApplication;

View File

@@ -6,7 +6,7 @@ using ServiceHost.BaseControllers;
namespace ServiceHost.Areas.Admin.Controllers;
public class ContractingPartyController : AdminController
public class ContractingPartyController : AdminBaseController
{
private readonly IPersonalContractingPartyApp _contractingPartyApplication;

View File

@@ -3,9 +3,9 @@ using CompanyManagment.App.Contracts.Employee;
using Microsoft.AspNetCore.Mvc;
using ServiceHost.BaseControllers;
namespace ServiceHost.Api.Areas.Admin.Controllers;
namespace ServiceHost.Areas.Admin.Controllers;
public class EmployeesController:AdminController
public class EmployeesController:AdminBaseController
{
private readonly IEmployeeApplication _employeeApplication;
private readonly IAuthHelper _authHelper;

View File

@@ -5,7 +5,7 @@ using ServiceHost.BaseControllers;
namespace ServiceHost.Areas.Admin.Controllers;
public class EmployerController : AdminController
public class EmployerController : AdminBaseController
{
private readonly IEmployerApplication _employerApplication;

View File

@@ -6,7 +6,7 @@ using ServiceHost.BaseControllers;
namespace ServiceHost.Areas.Admin.Controllers;
public class RepresentativeController : AdminController
public class RepresentativeController : AdminBaseController
{
private readonly IRepresentativeApplication _representativeApplication;

View File

@@ -4,7 +4,7 @@ using ServiceHost.BaseControllers;
namespace ServiceHost.Areas.Admin.Controllers;
public class WorkshopController:AdminController
public class WorkshopController: AdminBaseController
{
private readonly IWorkshopApplication _workshopApplication;

View File

@@ -6,7 +6,7 @@ namespace ServiceHost.BaseControllers;
[Area("Admin")]
[ApiExplorerSettings(GroupName = "Admin")]
[Route("api/[area]/[controller]")]
public class AdminController:ControllerBase
public class AdminBaseController:ControllerBase
{
}

View File

@@ -0,0 +1,14 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace ServiceHost.Api.BaseControllers;
//[ApiExplorerSettings(GroupName = "Camera")]
[Authorize(Policy = "CameraArea")]
[Area("Camera")]
[Route("api/[area]/[controller]")]
public class CameraBaseController:ControllerBase
{
}

View File

@@ -0,0 +1,13 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace ServiceHost.Api.BaseControllers;
//[Authorize(Policy = "ClientArea")]
[Area("Client")]
[ApiExplorerSettings(GroupName = "Client")]
[Route("api/[area]/[controller]")]
public class ClientBaseController: ControllerBase
{
}

View File

@@ -0,0 +1,13 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace ServiceHost.Api.BaseControllers;
[ApiExplorerSettings(GroupName = "General")]
[Route("api/[controller]")]
public class GeneralBaseController:ControllerBase
{
}

View File

@@ -0,0 +1,23 @@
using System.Globalization;
using Microsoft.AspNetCore.Mvc;
using ServiceHost.Api.BaseControllers;
namespace ServiceHost.Controllers;
public class GeneralController:GeneralBaseController
{
[HttpGet("Dates")]
public IActionResult GetDates()
{
var pc = new PersianCalendar();
var now = DateTime.Now;
var currentYear = pc.GetYear(now);
var years = Enumerable.Range(1370, currentYear - 1370 + 1).ToList();
var months = Enumerable.Range(1, 12).ToList();
var currentDate = new { Year = currentYear, Month = pc.GetMonth(now), Day = pc.GetDayOfMonth(now) };
return new JsonResult(new
{
years,months,currentDate
});
}
}