Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This may not be the best approach... </p> <p>Its hard to tell, but drying up the controllers, and moving out the business logic may help. It looks like you want to maintain the functionality of Actions B, and C.</p> <pre><code>$.ajax({ type: "POST", async: false, dataType: 'json', url: "ControllerA/ActionA", data: { var1: some_value }, success: function (data) { if (data == true) { form.submit(); } else if (data == false) { } }); public Class CalculationsA { public void DoCalculation() {} } public Class CalculationsB { public void DoCalculation() {} } public Class CalculationsC { public IQueryable&lt;somethign&gt; DoCalculation() {} } //_a is declared in Controller A as CalculationsA //_b is declared in Controller B as CalculationsB //_c is declared in Controller C as CalculationsC // In ControllerA public JsonResult ActionA(string var1) { _a.DoCalculation(); _slist = _b.DoCalculation().First().ToString(); Session["STRING"] = some_value; _c.DoCalculation(); /* your other logic... */ return Json(retval, JsonRequestBehavior.AllowGet); } // In ControllerB public JsonResult ActionB(string var1) { _b.DoCalculation(); return Json(false, JsonRequestBehavior.AllowGet); } public SelectList ActionC(string var1) { _c.DoCalculation(); Session["STRING"] = some_value; return new SelectList(_storeOrderTimeDictionaryList, "Value", "Key"); } </code></pre> <p>BTW, you should check out <a href="http://ninject.org/" rel="nofollow noreferrer">Ninject</a>, Castle Windsor, Structure Map, or any other DI/IOC container, to help you test this logic (and make it dryer). Try searching for ninject asp.net mvc 2 tutorial</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload