Добавьте файлы проекта.
This commit is contained in:
12
Services/Numbers/Extentions/ServiceCollectionExtentions.cs
Normal file
12
Services/Numbers/Extentions/ServiceCollectionExtentions.cs
Normal 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>();
|
||||
}
|
||||
}
|
||||
6
Services/Numbers/INumbersService.cs
Normal file
6
Services/Numbers/INumbersService.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace Services.Numbers;
|
||||
|
||||
public interface INumbersService
|
||||
{
|
||||
byte[] GetNumbers(byte count);
|
||||
}
|
||||
49
Services/Numbers/NumbersService.cs
Normal file
49
Services/Numbers/NumbersService.cs
Normal 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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user