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();
          }
        }
      }

      Csharp language logo
      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

      0 Comments

        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.