Add entries controller
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user