diff --git a/Component/Entries/EntriesController.cs b/Component/Entries/EntriesController.cs index feea567..5e8da28 100644 --- a/Component/Entries/EntriesController.cs +++ b/Component/Entries/EntriesController.cs @@ -1,4 +1,5 @@ -using Microsoft.AspNetCore.Mvc; +using Diary.Component.Entries.Service; +using Microsoft.AspNetCore.Mvc; using System; using System.Collections.Generic; using System.Linq; @@ -11,9 +12,20 @@ namespace Diary.Component.Entries [Route("[controller]")] public class EntriesController:ControllerBase { - public EntriesController() - { + private readonly IEntryService _entryService; + public EntriesController(IEntryService entryService) + { + _entryService = entryService ?? throw new ArgumentNullException(nameof(entryService)); } + + + + [HttpPost] + public async Task CreateEntryAsync(CreateEntryResource create) + { + return await _entryService.CreateAsync(create); + } + } } diff --git a/Data/UnitOfWork.cs b/Data/UnitOfWork.cs new file mode 100644 index 0000000..1918b17 --- /dev/null +++ b/Data/UnitOfWork.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Diary.Data +{ + public class UnitOfWork + { + public UnitOfWork() + { + + } + + } +} diff --git a/Installers/DependencyInstallers.cs b/Installers/DependencyInstallers.cs index 57bcb12..755638c 100644 --- a/Installers/DependencyInstallers.cs +++ b/Installers/DependencyInstallers.cs @@ -1,4 +1,6 @@ -using System; +using Diary.Component.Entries.Repository; +using Diary.Component.Entries.Service; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -10,6 +12,11 @@ namespace Diary.Installers { public static IServiceCollection AddDependencies(this IServiceCollection services) { + + + services.AddScoped(); + services.AddScoped(); + return services; } diff --git a/Program.cs b/Program.cs index a331392..f1cb203 100644 --- a/Program.cs +++ b/Program.cs @@ -44,6 +44,11 @@ try builder.Services.AddDatabase(builder.Configuration); builder.Services.AddScoped(); + //---y + //Dependancies + builder.Services.AddDependencies(); + + //---Y //Automapper builder.Services.AddAutoMapper(Assembly.GetExecutingAssembly());