Добавьте файлы проекта.

This commit is contained in:
Yevgeniy Ulyantsev
2024-02-02 17:36:06 +03:00
parent e787cd8afd
commit f034e41c07
27 changed files with 495 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
namespace Services.Numbers.Extentions;
public static class ServiceCollectionExtentions
{
public static void TyAddNumbersService(this IServiceCollection services)
{
services.TryAddScoped<INumbersService, NumbersService>();
}
}

View File

@@ -0,0 +1,6 @@
namespace Services.Numbers;
public interface INumbersService
{
byte[] GetNumbers(byte count);
}

View File

@@ -0,0 +1,49 @@
namespace Services.Numbers;
internal class NumbersService : INumbersService
{
public byte[] GetNumbers(byte count = 6)
{
byte[] init =
[
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36
];
Random.Shared.Shuffle(init);
return init.Take(count).ToArray();
}
}