title: Modal window with Partial View (ASP.NET MVC)
body: <p>I have modal window in my View, it's displaying by button.</p>
  
  <p>View for modal window is Partial View</p>
  
  <blockquote>
    <p>Here is code of Partial View</p>
  </blockquote>
  
  <pre><code>&lt;script src="~/Scripts/jquery-3.1.1.js"&gt;&lt;/script&gt;
  &lt;script src="~/Scripts/jquery-ui-1.12.1.js"&gt;&lt;/script&gt;
  &lt;div&gt;
      &lt;div class="form-group" style="text-align:center;padding-bottom: 20px; padding-top: 10px;"&gt;
          &lt;input type="text" class="form-control" id="question", placeholder="Вопрос" /&gt;
      &lt;/div&gt;
      &lt;div class="form-group" style="text-align:center;padding-bottom: 20px; padding-top: 10px;"&gt;
          &lt;input type="text" class="form-control" id="answer" , placeholder="Время на ответ" /&gt;
      &lt;/div&gt;
      &lt;div class="form-group" style="text-align:center;padding-bottom: 20px; padding-top: 10px;"&gt;
          &lt;input type="text" class="form-control" id="prepare" , placeholder="Время на подготовку" /&gt;
      &lt;/div&gt;
      &lt;div class="form-group" style="text-align:center;padding-bottom: 20px; padding-top: 10px;"&gt;
          &lt;input type="text" class="form-control" id="retries" , placeholder="Попытки" /&gt;
      &lt;/div&gt;
      &lt;div class="form-group" style="text-align:center"&gt;
          &lt;input type="button" id="save_quest" value="Создать" class="btn btn-default" style="margin-right: 40px;" /&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  &lt;script&gt;
      $(document).ready(function () {
          $('#save_quest').click(function () {
              save();
          });
      });
      function save() {
          $.ajax({
              type: 'Post',
              dataType: 'Json',
              data: {
                  Question_new: $('#question').val(),
                  Answer: $('#answer').val(),
                  Preparing: $('#prepare').val(),
                  Retries: $('#retries').val(),
              },
              url: '@Url.Action("CreateNewQuestion", "Questions")',
              success: function (da) {
                  if (da.Result === "Success") {
                      window.location.href = da.RedirectUrl;
                  } else {
                      alert('Error' + da.Message);
                  }
              },
              error: function (da) {
                  alert('Error');
              }
          });
      }
  &lt;/script&gt;
  </code></pre>
  
  <p>I need to fill data and on save button write it table, so on Controller I have this code</p>
  
  <pre><code>[HttpPost]
  public ActionResult CreateNewQuestion(string Question_new, string Answer, string Preparing, string Retries)
  {
      Question quest = new Question
      {
          question = Question_new,
          TimeForAnswer = Answer,
          TimeForReady = Preparing,
          Retries = Retries,
      };
      db.Questions.Add(quest);
      db.SaveChanges();
  
      return Json(new { Result = "Success", Message = "Saved Successfully"});
  }
  </code></pre>
  
  <p>But when I click save button , I gets error. </p>
  
  <blockquote>
    <p>The parameters dictionary contains a null entry for parameter 'id' of non-nullable type 'System.Int32' for method 'System.Web.Mvc.ActionResult Index(System.String, System.String, System.String, System.String, System.String, System.String, System.String, System.String, System.String, System.String, Int32)' in 'SmartSolutions.Controllers.QuestionsController'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter.
    Parameter name: parameters</p>
  </blockquote>
  
  <p>When I set breakpoint on Post method it not hits.</p>
  
  <p>SO why so? It must generate id when I run Post method</p>