Skip to content

Commit

Permalink
Changed GetTypes to return a Dictionary + hex type
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaardsholt committed Mar 8, 2021
1 parent 56f09ce commit 5ad5998
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions barcoder/Controllers/ApiController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,24 @@ namespace barcoder.Controllers
public class ApiController : ControllerBase
{
[HttpGet]
public List<Barcode> GetTypes()
public Dictionary<string, int> GetTypes()
{
var allowedBarcodes = MultiFormatWriter.SupportedWriters.ToList();
var AllBarcodes = new List<Barcode>();
var AllBarcodes = new Dictionary<string, int>();

foreach (int i in Enum.GetValues(typeof(BarcodeFormat)))
{
var name = Enum.GetName(typeof(BarcodeFormat), i);

var isAllowed = allowedBarcodes.Any(a => Enum.GetName(typeof(BarcodeFormat), a) == name);
if (isAllowed)
AllBarcodes.Add(new Barcode { Key = name, Value = i });

{
AllBarcodes.Add(name, i);
}

}
AllBarcodes.Add("HEX", 99999);

return AllBarcodes;
}

Expand Down

0 comments on commit 5ad5998

Please sign in to comment.