The koossery.MVCwin controller is just a class that extends Koossery.MVCwin.Controller.impl.ControllerBase class. You can create a controller class by hand, following these steps:
  1. Right-click the folder where you want to create the controller and select the menu option Add, New Item and select the Class template (see Figure 4).
  2. Name the new class CustomController.cs for instance and click the Add button.
  3. Modify the resulting class file so that the class inherits from the base Koossery.MVCwin.Controller.impl.ControllerBase class (see Listing 3).

Figure 4:

New_Controller.PNG

Listing 3 : Controllers\contact\CustomController

using System;
using System.Collections.Generic;
using System.Text;
using Koossery.MVCwin.Actions.itf;

namespace Koossery.MVCwin.Tuto.App_Code.controllers.contact
{
    public class CustomController : Koossery.MVCwin.Controller.impl.ControllerBase
    {
        public IActionResult Init()
        {
            return View(typeof(CustomView).Name);
        }
    }
}

The controller in Listing 3 exposes one action named Init() that returns the view CutomView. You can invoke this controller action by running your application and writing a code like the following:

Invoke(typeof(CustomController).Name, “Init”);

NB : There is not need for your controller to have the Controller suffix. You can name your controller as you do usually.

Last edited Jun 19, 2009 at 4:52 PM by mohamadou, version 5

Comments

No comments yet.