Adding
This commit is contained in:
+14
@@ -0,0 +1,14 @@
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Extensions;
|
||||
|
||||
public static class DateTimeExtensions
|
||||
{
|
||||
public static DateTime StartOfMonth(this DateTime date)
|
||||
{
|
||||
return DateTime.SpecifyKind(new DateTime(date.Year, date.Month, 1), date.Kind);
|
||||
}
|
||||
|
||||
public static DateTime EndOfMonth(this DateTime date)
|
||||
{
|
||||
return DateTime.SpecifyKind(date.StartOfMonth().AddMonths(1).AddSeconds(-1), date.Kind);
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
using Microsoft.AspNetCore.Mvc.ModelBinding;
|
||||
|
||||
namespace LCU.API.Internal.Operations.IncentiveApi.Extensions
|
||||
{
|
||||
public static class ModelStateMessages
|
||||
{
|
||||
public static List<string> GetErrorMessages(this ModelStateDictionary dictionary)
|
||||
{
|
||||
if (dictionary == null)
|
||||
{
|
||||
return new List<string>();
|
||||
}
|
||||
|
||||
return dictionary.SelectMany(m => m.Value.Errors)
|
||||
.Select(m => m.ErrorMessage)
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user