ASP NET Core Creates the base of a controller




    C# recipes

    This code defines a namespace named Name.Controllers and a controller class named NameController. The controller class has two public methods: Index() and Welcome(). Index() returns a view and Welcome() displays a message in the view.

    Shortcut: ac_controller

    namespace Name.Controllers
      using Microsoft.AspNetCore.Mvc;
      public class NameController : Controller
        public IActionResult Index()
          return View();
        public IActionResult Welcome()
          ViewData["Message"] = "Your welcome message";
          return View();
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    • Security
    • Privacy Policy
    • Code Privacy
    • Terms of Service
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.