mirror of
https://github.com/rudollee/LearningMVC.git
synced 2025-06-07 16:06:21 +00:00
29 lines
817 B
C#
29 lines
817 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.Mvc;
|
|
using System.Web.Routing;
|
|
|
|
namespace ControllersAndActions.Controllers
|
|
{
|
|
public class BasicController : IController
|
|
{
|
|
public void Execute(RequestContext requestContext)
|
|
{
|
|
string controller = (string)requestContext.RouteData.Values["controller"];
|
|
string action = (string)requestContext.RouteData.Values["actionn"];
|
|
|
|
requestContext.HttpContext.Response.Write(string.Format("Controller: {0}, Action: {1}", controller, action));
|
|
|
|
if (action.ToLower() == "redirect")
|
|
{
|
|
requestContext.HttpContext.Response.Redirect("/Derived/Index");
|
|
}
|
|
else
|
|
{
|
|
requestContext.HttpContext.Response.Write(string.Format("Controller: {0}, Action: {1}", controller, action));
|
|
}
|
|
}
|
|
}
|
|
} |