samedi 28 mars 2015

ASP.net MVC 5 C# returning the double from within IF statement

how do i access the double from within the IF statement



[HttpPost]
public ActionResult Iflexcst([Optional] float Quan, [Optional] float kammid, [Optional] float kammod, [Optional] float SpacerInnerDim, [Optional] float SpacerOuterDim, [Optional] float WashOuterDim, [Optional]float IsoWashInnerDim, [Optional]float SteelWashInnerDim, [Optional] float SteelWashQuan, [Optional] float IsoWashQuan, FormCollection form)
{
//other functions removed
if (WashOuterDim <= 43.6)
{

double washerSerrTime = 0.6;
double SerrWasherRun = (washerSerrTime * IsoWashQuan) * (1 / 60);
ViewBag.SerrWasherRun = SerrWasherRun;

double SerrWasherRunPrice = ((SerrateSetup / Quan) + washerSerrTime) * serrateRate;
ViewBag.SerrWasherRunPrice = SerrWasherRunPrice;

}

if (WashOuterDim > 43.6)
{


double washerSerrTime = 0.833;
double SerrWasherRun = (washerSerrTime * IsoWashQuan) * (1 / 60);
ViewBag.SerrWasherRun = SerrWasherRun;

double SerrWasherRunPrice = ((SerrateSetup / Quan) + washerSerrTime) * serrateRate;
ViewBag.SerrWasherRunPrice = SerrWasherRunPrice;


}


// Adds together all costs
float Price = (float)SerrWasherRunPrice;


It recommends creating a getting and setting for "SerrWasherRunPrice" or making it a public variable, but both these solutions give me conflicts with another declaration.


Aucun commentaire:

Enregistrer un commentaire