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

  • SEARCH
  • Home
  • 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 7633803
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T06:59:16+00:00 2026-05-31T06:59:16+00:00

Is it possible to do an overload of the actions in the controller? I

  • 0

Is it possible to do an overload of the actions in the controller? I haven’t found any info about it and when I tried, I got this error:

The current request for action ‘Create’ on controller type ‘InterviewController’ is >ambiguous between the following action methods:
System.Web.Mvc.ViewResult Create() on type >MvcApplication4.MvcApplication4.InterviewController
System.Web.Mvc.ViewResult Create(Int32) on type >MvcApplication4.MvcApplication4.InterviewController

I’ve tried to do this on another way and I also get a new error that I can’t fix. In fact, I created a new action (called create_client instead of create)

I need 2 ways of creating an “opportunite”.

  1. I just call the action, and I receive an empty formular in which I just have to insert data.
  2. From a client’s page, I must create an “opportunite” with the client that’s already completed when the form is displayed to the user. (there is a need of productivity, the user must perform actions as fast as possible).

In the table “opportunite”, I’ve got a column called “FK_opp_client”, which is equal to the column “idClient” from the client’s table.

I don’t get how I can do the second way.

I’ve created a new action in the controller.

    '
    ' GET: /Opportunite/Create_client

Function Create_client(idclient) As ViewResult
    'Dim FK_Client = (From e In db.client
    'Where(e.idClient = idclient)
    '                    Select e.nomCompteClient).ToString()
    'ViewBag.FK_client = New SelectList(db.client, "idClient", "nomCompteClient", idclient)
    Dim opportunite As opportunite = db.opportunite.Single(Function(o) o.idOpportunite = 5)
    opportunite.FK_Client = idclient
    ViewBag.FK_Client = New SelectList(db.client, "idClient", "nomCompteClient", opportunite.FK_Client)

    Return View(opportunite)
End Function

I’ve tried a few things to get what I wanted, the last one was to copy what was done in the “Edit” action, but for an empty rank. (so I created an empty rank in my DB). I don’t think it was a good idea (imagine someone wants to update the DB where idOpportunite = 5…)

Any better 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-05-31T06:59:18+00:00Added an answer on May 31, 2026 at 6:59 am

    If you want to keep those two methods under the same name, you will have to implement an ActionSelectionAttribute to decorate them, or use them with different verbs (for example POST and PUT). Please read more details on action method selection process here (old but still true).

    Different approach might be making your parameter optional and make action to check if it has been passed or not (through nullable type).

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

Sidebar

Related Questions

Simplified from this question and got rid of possible affect from LinqPad(no offsensive), a
Possible Duplicate: Any reason to overload global new and delete? In c++ you can
Is it possible to overload [] operator twice? To allow, something like this: function[3][3]
Possible Duplicate: Overload ++ operator Say i have a class in which i overloads
Is it possible to overload the null-coalescing operator for a class in C#? Say
Is it possible to overload the default function operator (the () operator) in C#?
Why is it not possible to overload a function just by changing the return
Still wrapping my head around Delegates and I'm curious: Is it possible to overload
Hey, I'm trying to figure out if it's possible to overload a template class
Possible Duplicate: Java operator overload In c++, we can perform the operator overloading. But

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.