From 2e4903481c8d3a6120997aafe374e0877d13181c Mon Sep 17 00:00:00 2001 From: Ryan Peters Date: Fri, 28 Jul 2023 14:52:53 -0400 Subject: [PATCH] use expression bodies --- Controllers/ApiController.cs | 5 +---- Controllers/NoteController.cs | 5 +---- Services/FileNoteService.cs | 10 ++-------- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/Controllers/ApiController.cs b/Controllers/ApiController.cs index 2112ea0..4cd72ef 100644 --- a/Controllers/ApiController.cs +++ b/Controllers/ApiController.cs @@ -7,10 +7,7 @@ namespace BinaryDad.Notes.Controllers { private readonly INoteService noteService; - public ApiController(INoteService noteService) - { - this.noteService = noteService; - } + public ApiController(INoteService noteService) => this.noteService = noteService; public string Note() => noteService.Get(); } diff --git a/Controllers/NoteController.cs b/Controllers/NoteController.cs index 8f0c6a2..53f2540 100644 --- a/Controllers/NoteController.cs +++ b/Controllers/NoteController.cs @@ -9,10 +9,7 @@ public class NoteController : Controller { private readonly INoteService noteService; - public NoteController(INoteService noteService) - { - this.noteService = noteService; - } + public NoteController(INoteService noteService) => this.noteService = noteService; public IActionResult Index() { diff --git a/Services/FileNoteService.cs b/Services/FileNoteService.cs index 82137bb..cd662be 100644 --- a/Services/FileNoteService.cs +++ b/Services/FileNoteService.cs @@ -15,14 +15,8 @@ } } - public string Get() - { - return File.ReadAllText(filePath); - } + public string Get() => File.ReadAllText(filePath); - public void Save(string content) - { - File.WriteAllText(filePath, content); - } + public void Save(string content) => File.WriteAllText(filePath, content); } }