refactor date parsing method in RollCallCaseHistoryController

This commit is contained in:
2026-02-02 19:08:25 +03:30
parent bf2a102a55
commit 3dace574ff

View File

@@ -78,29 +78,13 @@ public class RollCallCaseHistoryController : ClientBaseController
return op.Succcedded(duration);
}
private static bool TryParseDateTime(string date, string time, out DateTime result)
{
result = default;
try
{
var dateTime = date.ToGeorgianDateTime();
var timeOnly = TimeOnly.Parse(time);
result = dateTime.AddTicks(timeOnly.Ticks);
return true;
}
catch
{
return false;
}
}
[HttpGet("excel")]
public async Task<IActionResult> GetDownload(string titleId, RollCallCaseHistorySearchModel searchModel)
{
var res =await _rollCallApplication.DownloadCaseHistoryExcel(_workshopId, titleId, searchModel);
return File(res.Bytes,
res.MimeType,
res.FileName);
@@ -127,4 +111,22 @@ public class RollCallCaseHistoryController : ClientBaseController
// TotalRollCallsDuration = total.ToFarsiHoursAndMinutes("-")
// };
// }
private static bool TryParseDateTime(string date, string time, out DateTime result)
{
result = default;
try
{
var dateTime = date.ToGeorgianDateTime();
var timeOnly = TimeOnly.Parse(time);
result = dateTime.AddTicks(timeOnly.Ticks);
return true;
}
catch
{
return false;
}
}
}