Add entries controller

This commit is contained in:
2022-08-10 21:14:27 +01:00
parent 8978af10bc
commit 2ac5937096
4 changed files with 45 additions and 4 deletions

View File

@@ -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<EntryResource> CreateEntryAsync(CreateEntryResource create)
{
return await _entryService.CreateAsync(create);
}
}
}