Notes/Controllers/HomeController.cs

28 lines
612 B
C#
Raw Normal View History

2023-05-12 16:38:13 +00:00
using BinaryDad.Notes.Models;
using BinaryDad.Notes.Services;
2023-01-05 15:32:21 +00:00
using Microsoft.AspNetCore.Mvc;
2022-11-29 15:14:15 +00:00
namespace BinaryDad.Notes.Controllers;
public class HomeController : Controller
{
2023-01-05 15:32:21 +00:00
private readonly INoteService noteService;
2022-11-29 15:14:15 +00:00
2023-01-05 15:32:21 +00:00
public HomeController(INoteService noteService)
2022-11-29 15:14:15 +00:00
{
2023-01-05 15:32:21 +00:00
this.noteService = noteService;
2022-11-29 15:14:15 +00:00
}
[Route("{noteName?}")]
public IActionResult Index(string? noteName)
2022-11-29 15:14:15 +00:00
{
2023-05-12 16:38:13 +00:00
var model = new ContentModel
{
Text = noteService.GetText(noteName),
NoteNames = noteService.GetNoteNames()
};
2022-11-29 15:14:15 +00:00
2023-05-12 16:38:13 +00:00
return View(model);
2022-11-29 15:14:15 +00:00
}
}