Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7938471
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:49:21+00:00 2026-06-03T22:49:21+00:00

I have a controller for my entire database, the code is below: public class

  • 0

I have a controller for my entire database, the code is below:

public class YogaController : DbDataController<Yoga.Models.YOGAEntities>
{
    public YogaController()
    {
    }

    public IQueryable<Yoga.Models.Action> GetActions(int BugId)
//GetActions retrieves "actions" table from the db, not Actions in MVC term 
    {
        return DbContext.Actions.Where(x => x.FK_BugsID == BugId);
    }
    public IQueryable<Yoga.Models.Label> GetRequiredLabels()
    {
        return DbContext.Labels.Where(x => x.IsRequired == true);
    }
    public IQueryable<Yoga.Models.Role> GetRoles()
    {
        return DbContext.Roles;
    }
    public IQueryable<Role> GetRoles2() //TODO: finish this
    {
        return DbContext.Roles.Where(x => x.RoleID == 1);
    }
    public IQueryable<Tag> GetTags(int actionid)
    {
        return DbContext.Tags.Where(x => x.J_Tags.Any(y => y.FK_ActionID == actionid));
    }
}

As you can see I have multiple IQueryable in one controller, each querying a different table. Is it something that’s forbidden? Because when I go to localhost/api/Yoga/GetActions or localhost/api/Yoga/GetRequiredLabels I get the error message:

Multiple actions were found that match the request: 
 System.Linq.IQueryable`1[Yoga.Models.Label] GetRequiredLabels() on type Yoga.Controllers.YogaController
 System.Linq.IQueryable`1[Yoga.Models.Role] GetRoles() on type Yoga.Controllers.YogaController
 System.Linq.IQueryable`1[Yoga.Models.Role] GetRoles2() on type Yoga.Controllers.YogaController

When I disable all but one IQueryable, the results came out fine.

I have googled for similar issues and checked my routing settings, there are no conflicts in controller path and names.

My Routes (default generated):

    public static void RegisterRoutes(RouteCollection routes)
    {
        routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
        routes.MapHttpRoute(
            name: "DefaultApi",
            routeTemplate: "api/{controller}/{id}",
            defaults: new { id = RouteParameter.Optional }
        );
        //routes.MapRoute(
        //    name: "Default",
        //    url: "{controller}/{action}/{id}",
        //    defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
        );
    }

Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T22:49:22+00:00Added an answer on June 3, 2026 at 10:49 pm

    MVC4 is probably matching your HTTP Verb (Get) against all methods with names starting with ‘Get’ and no parameters. Try forcing the action name:

    [ActionName("GetRequiredLabels")]
    public IQueryable<Yoga.Models.Label> GetRequiredLabels()
    ...
    [ActionName("GetActions")]
    public IQueryable<Yoga.Models.Action> GetActions(int BugId)
    ... // etc
    

    EDIT:

    Based on the routes you pasted and your controller, I think your routes should be:

    public static void RegisterRoutes(RouteCollection routes)
    {
        routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
        routes.MapHttpRoute(
            name: "DefaultApi",
            routeTemplate: "api/{controller}/{action}/{id}",
            defaults: new { id = RouteParameter.Optional }
        );
    }
    

    i.e. it should have the {action} in there. The default MVC4 route would work if you only had a single ‘Get’ method. Since you have multiple, you’ll have to force it to pick the action based on the route.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have @Controller @RequestMapping(value=core/*) public class CoreController { public static String exceptionOccurredView = /core/exceptionOccurred;
I have controller with action new , and I want it to create ActiveRecord::Base
I have Controller: [MySite]\Controllers\DistributionTools\TrackingChannelsController.cs [HttpPost] public void InitTcFirstPageView() { var model = new TcFirstPageModel
I have a controller defined as: [AcceptVerbs(HttpVerbs.Post)] public JsonResult PostMoreData(DataContracts.Address address, DataContracts.GeoLocation geoLocation) {
I have a controller action that checks this.User.Identity.IsAuthenticated What do you suggest how to
I have an AJAX controller action which returns JSON. The returned JSON is handled
Let's say I have a controller function with these lines: $this->load->view('stdHeader_view'); echo <div class='main'>;
I have been debugging this the entire day. I have two models in my
Issue: I have a standard subclassed NSManagedObject (see below). I have a view controller
I have controller PlayerController and actions inside: View , Info , List . So

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.