23 lines
715 B
C#
23 lines
715 B
C#
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
|
|
});
|
|
}
|
|
} |