redirectToAction results in null model

Posted by Maslow on Stack Overflow See other posts from Stack Overflow or by Maslow
Published on 2010-03-26T19:45:38Z Indexed on 2010/03/26 21:13 UTC
Read the original article Hit count: 328

Filed under:

I have 2 actions on a controller:

public class CalculatorsController : Controller
{
    //
    // GET: /Calculators/

    public ActionResult Index()
    {
        return RedirectToAction("Accounting");
    }


    public ActionResult Accounting()
    {
        var combatants = Models.Persistence.InMemoryCombatantPersistence.GetCombatants();
        Debug.Assert(combatants != null);
        var bvm = new BalanceViewModel(combatants);
        Debug.Assert(bvm!=null);
        Debug.Assert(bvm.Combatants != null);
        return View(bvm);
    }

}

When the Index method is called, I get a null model coming out. When the Accounting method is called directly via it's url, I get a hydrated model.

© Stack Overflow or respective owner

Related posts about asp.net-mvc