Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Dmitriy 168 posts 588 karma points
    Jun 26, 2019 @ 14:47
    Dmitriy
    0

    Using additional methods in a hijacked controller

    Hello.

    I prefer all that relates with something are concentrated in one place, so I wanted to make a controller with hijacked route for my page.

    Here is some code:

    public class BlogPageController : RenderMvcController // Hijacked!
    {
        public override ActionResult Index(RenderModel model)
        {
            return base.Index(model);
        }
    
        // I want use this somehow
        public JsonResult Some(SomeModel model)
        {
            return Json(model, JsonRequestBehavior.AllowGet); // do some stuff
        }
    }
    
    public class SomeModel
    {
        public string one { get; set; }
        public string another { get; set; }
    }
    

    I want to make some query to url like /blog and a make a request like /blog/some?one=1&another=2

    How to request Some(SomeModel) method?

    Or any other way to make a concentrated logic?

  • Yakov Lebski 549 posts 2113 karma points
    Jun 27, 2019 @ 10:20
    Yakov Lebski
    0

    I think that method in RenderMvcController it means Template, you can change the template in back-office or browse to the alternative template /blog?alternativeTemplate=Some

Please Sign in or register to post replies

Write your reply to:

Draft