SunJian/WebApi/Controllers/DictionaryController.cs

22 lines
548 B
C#

using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using WebApi.Data;
namespace MyApp.Namespace;
[Route("[controller]")]
[ApiController]
public class DictionaryController(DictionaryDbContext dictionaryDbContext) : ControllerBase
{
private readonly DictionaryDbContext _dictionaryDbContext = dictionaryDbContext;
[HttpGet]
public async Task<IActionResult> GetWordDetailAsync(string word)
{
var result = _dictionaryDbContext.Dicts.Find(word);
await Task.Delay(10);
return Ok(result);
}
}