// GET: PersonToPredicts public ActionResult CensusPrediction() { //Creating a PersonToPredictModel for a user PersonToPredictModel toPredict = new PersonToPredictModel(); return(View(toPredict)); }
public ActionResult CensusPrediction(PersonToPredictModel predictModel) { if (ModelState.IsValid) { ConverterModels.ConverterToItemList.PredictScore(predictModel); predictModel.Above50kProp = ConverterModels.ConverterToItemList.above50k * 100; predictModel.Below50kProp = ConverterModels.ConverterToItemList.below50k * 100; return(View(predictModel)); } else { return(View()); } }
public static void PredictScore(PersonToPredictModel userPredict) { CensusPredictionBusinessLogic.DataAccessKontroller.DataClasses.PersonToPredict toPredict = new CensusPredictionBusinessLogic.DataAccessKontroller.DataClasses.PersonToPredict() { Age = userPredict.Age, Capitalgain = userPredict.Capitalgain, educationNo = userPredict.educationNo, hourPerweek = userPredict.hourPerweek, idcountry = userPredict.idcountry, ideducation = userPredict.ideducation, idMartialStatus = userPredict.idMartialStatus, idOccupation = userPredict.idOccupation, idrace = userPredict.idrace, idrelationship = userPredict.idrelationship, idworkclass = userPredict.idworkclass, ifWoman = userPredict.ifWoman, modelName = userPredict.modelName }; CensusPredictionBusinessLogic.DataAccessKontroller.PredictGetter getter = new PredictGetter(access, toPredict); List <PredictedScore> result = getter.GetPredictions(); above50k = result[0].IncomeAbove50; below50k = result[0].IncomeBelow50; }