diff --git a/OdeToFoodRider/OdeToFoodRider/Controllers/HomeController.cs b/OdeToFoodRider/OdeToFoodRider/Controllers/HomeController.cs index c93c2c4..4153d72 100644 --- a/OdeToFoodRider/OdeToFoodRider/Controllers/HomeController.cs +++ b/OdeToFoodRider/OdeToFoodRider/Controllers/HomeController.cs @@ -1,10 +1,15 @@ +using Microsoft.AspNetCore.Mvc; +using OdeToFoodRider.Models; + namespace OdeToFoodRider.Controllers { - public class HomeController + public class HomeController : Controller { - public string Index() + public IActionResult Index() { - return "Hello from Rider's Home controller!"; + var model = new Restaurant() {Id = 1, Name = "Scott's Pizza Place"}; + + return new ObjectResult(model); } } } \ No newline at end of file diff --git a/OdeToFoodRider/OdeToFoodRider/Models/Restaurant.cs b/OdeToFoodRider/OdeToFoodRider/Models/Restaurant.cs new file mode 100644 index 0000000..67b85df --- /dev/null +++ b/OdeToFoodRider/OdeToFoodRider/Models/Restaurant.cs @@ -0,0 +1,8 @@ +namespace OdeToFoodRider.Models +{ + public class Restaurant + { + public int Id { get; set; } + public string Name { get; set; } + } +} \ No newline at end of file diff --git a/OdeToFoodVisualStudio/OdeToFoodVisualStudio/Controllers/HomeController.cs b/OdeToFoodVisualStudio/OdeToFoodVisualStudio/Controllers/HomeController.cs index 41bd26c..a5adf4e 100644 --- a/OdeToFoodVisualStudio/OdeToFoodVisualStudio/Controllers/HomeController.cs +++ b/OdeToFoodVisualStudio/OdeToFoodVisualStudio/Controllers/HomeController.cs @@ -1,15 +1,21 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using OdeToFoodVisualStudio.Models; namespace OdeToFoodVisualStudio.Controllers { - public class HomeController + public class HomeController : Controller { - public string Index() + public IActionResult Index() { - return "Hello from Visual Studio's Home controller"; + var model = new Restaurant { Id = 1, Name = "Scott's Pizza Place" }; + + return new ObjectResult(model); + + // VSRD: Visual Studio doesn't have a quick action to change return type if you try to return something that doesn't match it + // VSRD: Visual Studio's take on Extend/Shrink Selection (Shift+Alt+Plus/Minus) can't extend to a string literal except quotes, + // making it non-trivial to paste text into string literals - it can only extend to the whole string literal + //return Content("Hello from Visual Studio's Home controller"); + } } diff --git a/OdeToFoodVisualStudio/OdeToFoodVisualStudio/Models/Restaurant.cs b/OdeToFoodVisualStudio/OdeToFoodVisualStudio/Models/Restaurant.cs new file mode 100644 index 0000000..3423f6b --- /dev/null +++ b/OdeToFoodVisualStudio/OdeToFoodVisualStudio/Models/Restaurant.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace OdeToFoodVisualStudio.Models +{ + public class Restaurant + { + public int Id { get; set; } + public string Name { get; set; } + } +}