title: ambiguous between the following action methods
body: <p>I'm trying to make a delete functionality in my program. I followed <a href="http://www.compilemode.com/2015/09/crud-operations-in-aspnet-mvc-5.html" rel="nofollow noreferrer">this</a> tutorial. But when I tried deleting this error came out.</p>
  
  <p><a href="https://i.stack.imgur.com/HeiYM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HeiYM.png" alt="error message"></a></p>
  
  <p>here is my class from model for delete.</p>
  
  <pre><code>        public bool deleteAccount(int Id) {
          using (SqlConnection conn = new SqlConnection(connectionString))
          using (SqlCommand comObj = new SqlCommand("", conn)) {
              comObj.CommandText = "DELETE FROM account WHERE userId = @userId";
              comObj.Parameters.AddWithValue("@userId", Id);
              conn.Open();
              int res = comObj.ExecuteNonQuery();
              if (res &gt;= 1)
              {
  
                  return true;
  
              }
              else
              {
  
                  return false;
              }
          }
      }
  </code></pre>
  
  <p>My delete action controller</p>
  
  <pre><code>public ActionResult deleteAccount()
      {
          return View();
      }
  
      public ActionResult deleteAccount(int id)
      {
  
          try
          {
              var databaseModel = new database();
              if (databaseModel.deleteAccount(id)) {
                  ViewBag.AlertMsg = "Employee details deleted successfully";
              }
              return RedirectToAction("GetAllEmpDetails");
          }
          catch {
              return View();
          }
  </code></pre>
  
  <p>full stack trace</p>
  
  <p><code>[AmbiguousMatchException: The current request for action 'deleteAccount' on controller type 'accountController' is ambiguous between the following action methods:
  System.Web.Mvc.ActionResult deleteAccount() on type directory.Controllers.accountController
  System.Web.Mvc.ActionResult deleteAccount(Int32) on type directory.Controllers.accountController]
     System.Web.Mvc.ActionMethodSelectorBase.FindActionMethod(ControllerContext controllerContext, String actionName) +113
     System.Web.Mvc.Async.ReflectedAsyncControllerDescriptor.FindAction(ControllerContext controllerContext, String actionName) +54
     System.Web.Mvc.ControllerActionInvoker.FindAction(ControllerContext controllerContext, ControllerDescriptor controllerDescriptor, String actionName) +203
     System.Web.Mvc.Async.AsyncControllerActionInvoker.BeginInvokeAction(ControllerContext controllerContext, String actionName, AsyncCallback callback, Object state) +136
     System.Web.Mvc.Controller.&lt;BeginExecuteCore&gt;b__1c(AsyncCallback asyncCallback, Object asyncState, ExecuteCoreState innerState) +25
     System.Web.Mvc.Async.WrappedAsyncVoid</code>1.CallBeginDelegate(AsyncCallback callback, Object callbackState) +30
     System.Web.Mvc.Async.WrappedAsyncResultBase<code>1.Begin(AsyncCallback callback, Object state, Int32 timeout) +128
     System.Web.Mvc.Controller.BeginExecuteCore(AsyncCallback callback, Object state) +465
     System.Web.Mvc.Controller.&lt;BeginExecute&gt;b__14(AsyncCallback asyncCallback, Object callbackState, Controller controller) +18
     System.Web.Mvc.Async.WrappedAsyncVoid</code>1.CallBeginDelegate(AsyncCallback callback, Object callbackState) +20
     System.Web.Mvc.Async.WrappedAsyncResultBase<code>1.Begin(AsyncCallback callback, Object state, Int32 timeout) +128
     System.Web.Mvc.Controller.BeginExecute(RequestContext requestContext, AsyncCallback callback, Object state) +374
     System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.BeginExecute(RequestContext requestContext, AsyncCallback callback, Object state) +16
     System.Web.Mvc.MvcHandler.&lt;BeginProcessRequest&gt;b__4(AsyncCallback asyncCallback, Object asyncState, ProcessRequestState innerState) +52
     System.Web.Mvc.Async.WrappedAsyncVoid</code>1.CallBeginDelegate(AsyncCallback callback, Object callbackState) +30
     System.Web.Mvc.Async.WrappedAsyncResultBase<code>1.Begin(AsyncCallback callback, Object state, Int32 timeout) +128
     System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) +384
     System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContext httpContext, AsyncCallback callback, Object state) +48
     System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) +16
     System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +103
     System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously) +155
  </code></p>
  
  <p>Hope someone can help me.</p>
  
  <p>| EDIT |</p>
  
  <p>I tried other tutorials a while ago. and I also tried adding [HttpPost] but the ID being passed to the URL is always 0. so I tried displaying my userId </p>
  
  <pre><code>acc.userName = rdr["userId"].ToString();
  </code></pre>
  
  <p>and every ID I get is 0</p>