title: Why Ajax edit code not work properly? can you help me?
body: <p>I m working on simple registration i have two forms one is registration another is city, When city is newly added it get added update perfectly but when i use city in registration form eg pune. pune will not get edited or updated, code written in ajax</p>
  
  <pre><code>function UpdateCity(Ids) {
      debugger;
      var Id = { Id: Ids }
      $('#UpdateModel').modal('show');
  
      $.ajax({
          type: 'GET',
          url: "/City/GetCityDetail",
          data: Id,
          dataType: "json",
          success: function (city) {
              $('#EditCityName').val(city.CityName);
              $('#EditCityId').val(city.CityId);
          }
      })
  
  
  
      $('#UpdateCityButton').click(function () {
          var model = {
              CityName: $('#EditCityName').val(),
              CityId: $('#EditCityId').val()
          }
          debugger;
          $.ajax({
              type: 'POST',
              url: "/City/UpdateCity",
              data: model,
              dataType: "text",
              success: function (city) {
                  $('#UpdateModel').modal('hide');
                  bootbox.alert("City updated");
                  window.setTimeout(function () { location.reload() }, 3000)
              }
          })
      })
  }
  </code></pre>
  
  <p>Controller</p>
  
  <pre><code>public bool UpdateCity(City model, long CurrentUserId)
  {
      try
      {
          var city = db.Cities.Where(x =&gt; x.CityId == model.CityId &amp;&amp; x.IsActive == true).FirstOrDefault();
          if (city == null) return false;
          city.CityName = model.CityName;
          city.UpdateBy = CurrentUserId;
          city.UpdateOn = DateTime.UtcNow;
          db.SaveChanges();
          return true;
      }
      catch (Exception Ex)
      {
          return false;
      }
  }
  </code></pre>