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

38 lines
1.1 KiB
Markdown
Raw Normal View History

---
title: Adding a controller to an ASP.NET Core MVC app
author: rick-anderson
description: How to add a controller to a basic ASP.NET Core MVC app using Visual Studio of Mac
keywords: ASP.NET Core,MVC,controller
ms.author: riande
manager: wpickett
ms.date: 06/28/2017
ms.topic: article
ms.assetid: e04b6666-d0de-4d99-b78f-d6a0c4634a87
ms.technology: aspnet
ms.prod: asp.net-core
uid: tutorials/first-mvc-app-mac/adding-controller
---
2017-06-23 22:08:01 +08:00
# Adding a controller to an ASP.NET Core MVC app with Visual Studio for Mac
By [Rick Anderson](https://twitter.com/RickAndMSFT)
[!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)
[!INCLUDE[adding-controller2](../../includes/mvc-intro/adding-controller2.md)]
>[!div class="step-by-step"]
[Previous](../first-mvc-app/start-mvc.md)
[Next](adding-view.md)