Files
Diary/Component/Entries/EntriesController.cs
2022-08-10 21:14:27 +01:00

32 lines
683 B
C#

using Diary.Component.Entries.Service;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Diary.Component.Entries
{
[ApiController]
[Route("[controller]")]
public class EntriesController:ControllerBase
{
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);
}
}
}