Files
Backend-Api/ServiceHost/Areas/Admin/Controllers/GeneralController.cs

29 lines
899 B
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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
});
}
}