AspNetCore.Docs/aspnetcore/tutorials/first-mvc-app-mac/adding-controller.md

32 lines
1012 B
Markdown
Raw Normal View History

---
title: Add a controller to an ASP.NET Core MVC app with Visual Studio for Mac
2018-01-29 23:21:31 +08:00
author: rick-anderson
description: How to add a controller to a basic ASP.NET Core MVC app using Visual Studio of Mac
2018-01-29 23:21:31 +08:00
ms.author: riande
ms.date: 06/28/2017
uid: tutorials/first-mvc-app-mac/adding-controller
---
# Add a controller to an ASP.NET Core MVC app with Visual Studio for Mac
By [Rick Anderson](https://twitter.com/RickAndMSFT)
2018-04-05 07:51:35 +08:00
[!INCLUDE [adding-controller](../../includes/mvc-intro/adding-controller1.md)]
## Add a controller
In **Solution Explorer**, right-click **Controllers > Add > New File**.
![Contextual menu](adding-controller/_static/add_controller.png)
Select **ASP.NET Core** and **MVC Controller Class**.
Name the controller **HelloWorldController**.
![Add MVC controller and name it](adding-controller/_static/ac.png)
2018-04-05 07:51:35 +08:00
[!INCLUDE [adding-controller2](../../includes/mvc-intro/adding-controller2.md)]
2018-04-05 07:51:35 +08:00
> [!div class="step-by-step"]
> [Previous](../first-mvc-app/start-mvc.md)
> [Next](adding-view.md)