title: Why is my model properties reset to null on post-back?
body: <p>I create a view model and let the user edit one of the properties. On postbac/submit, the user-edited property is correct, but other properties reset to default (null) value. </p>
  
  <p>In the lower method I want to access Shift property, but it is null.</p>
  
  <p>What am I doing wrong?</p>
  
  <p>Thanks, </p>
  
  <p>Anders, Denmark</p>
  
  <pre><code>        public async Task&lt;ActionResult&gt; Status(int shiftId)
      {
          var shift = await _shiftRepository.GetByIdAsync(shiftId);
          var transition = await _shiftChangeRepository.GetByIdAsync(shiftId);
  
          if (!_permissionService.CurrentUserMayViewShift(shift,transition))
          {
              return RedirectToAction("NotAllowed");
          }
  
          // No prior transaction =&gt; ask user what to do
          if (transition == null)
          {
              var transitionStartModel = new TransitionStartModel(){Shift = shift};
  
              return View(transitionStartModel);
          }
  
          return null;
      }
  </code></pre>
  
  <p>-</p>
  
  <pre><code>        [HttpPost]
      [ValidateAntiForgeryToken]
      public ActionResult Status(TransitionStartModel model)
      {
          if (ModelState.IsValid)
          {
              try
              {
                  if (model.EnumTransitionTypes == EnumTransitionTypes.ReportSick)
                  {
                      return RedirectToAction("StartFlowReportSick");
                  }
  
                  return RedirectToAction("Index", "Home");
              }
              catch (Exception e)
              {
                  ModelState.AddModelError("", e.Message);
              }
          }
  
          // If we got this far, something failed, redisplay form
          return View(model);
      }
  </code></pre>