use expression bodies

This commit is contained in:
Ryan Peters 2023-07-28 14:52:53 -04:00
parent 70b0d0cba3
commit 2e4903481c
3 changed files with 4 additions and 16 deletions

View File

@ -7,10 +7,7 @@ namespace BinaryDad.Notes.Controllers
{ {
private readonly INoteService noteService; private readonly INoteService noteService;
public ApiController(INoteService noteService) public ApiController(INoteService noteService) => this.noteService = noteService;
{
this.noteService = noteService;
}
public string Note() => noteService.Get(); public string Note() => noteService.Get();
} }

View File

@ -9,10 +9,7 @@ public class NoteController : Controller
{ {
private readonly INoteService noteService; private readonly INoteService noteService;
public NoteController(INoteService noteService) public NoteController(INoteService noteService) => this.noteService = noteService;
{
this.noteService = noteService;
}
public IActionResult Index() public IActionResult Index()
{ {

View File

@ -15,14 +15,8 @@
} }
} }
public string Get() public string Get() => File.ReadAllText(filePath);
{
return File.ReadAllText(filePath);
}
public void Save(string content) public void Save(string content) => File.WriteAllText(filePath, content);
{
File.WriteAllText(filePath, content);
}
} }
} }