29 lines
899 B
C#
29 lines
899 B
C#
using System.Globalization;
|
||
using Microsoft.AspNetCore.Mvc;
|
||
using ServiceHost.BaseControllers;
|
||
|
||
namespace ServiceHost.Areas.Admin.Controllers;
|
||
|
||
public class GeneralController:AdminBaseController
|
||
{
|
||
/// <summary>
|
||
/// نمایش اطلاعات عمومی مانند تاریخ ها و سال ها
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[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
|
||
});
|
||
}
|
||
} |