Updated `GetEnumAsDictionary<TEnum>` in `MemoryCacheExtensions.cs` to use a loop for populating a dictionary of enum values, removing LINQ for simplicity. Modified `HistoryController.cs` to adjust method signatures for `GetReferenceTypes` and `GetEnvelopeStatus`, allowing optional parameters for better conditional responses. Added necessary using directives.
21 lines
502 B
C#
21 lines
502 B
C#
using Microsoft.Extensions.Caching.Memory;
|
|
using System;
|
|
|
|
namespace EnvelopeGenerator.Extensions;
|
|
|
|
public static class MemoryCacheExtensions
|
|
{
|
|
public static IDictionary<string, int> GetEnumAsDictionary<TEnum>(this IMemoryCache memoryCache)
|
|
where TEnum : Enum
|
|
{
|
|
var dict = new Dictionary<string, int>();
|
|
|
|
foreach (TEnum role in Enum.GetValues(typeof(TEnum)))
|
|
{
|
|
dict[role.ToString()] = Convert.ToInt32(role);
|
|
}
|
|
|
|
return dict;
|
|
}
|
|
}
|