public ActionResult SetupGuaranteeTexts() { var context = GetContext(); var configId = GetConfigID(); var texts = GuaranteeModel.GuaranteeModels(context, configId); //var texts = new[] // { // new GuaranteeModel // { // Id = 1, // GuaranteeName = "guar1", // GuaranteeText = "guar1text" // }, // new GuaranteeModel // { // Id = 2, // GuaranteeName = "guar2", // GuaranteeText = "guar2text" // } // }; return(PartialView(texts)); }
private VerificationResult VerificationGuaranteeTexts() { var texts = GuaranteeModel.GuaranteeModels(_context, _configId); var result = new VerificationResult { NameOfVerification = "Guarantee Text Validation", Result = true, Message = "" }; foreach (var guaranteeModel in texts) { if (String.IsNullOrEmpty(guaranteeModel.GuaranteeText)) { result.Result = false; result.Message += String.Format("Guarantee {0} has no text\n", guaranteeModel.GuaranteeName); } } if (result.Result) { result.Message = "All guarantees have texts"; } return(result); }
//private GuaranteeModel[] GuaranteeModels(EightHundredEntities context, int configId) //{ // var listOfGuaranteeIds = context.tbl_HVAC_Guarantees.Select(item => item.GuaranteeID).ToList(); // var listOfselectedGuarantees = // context.tbl_HVAC_ConfigQuestions.Where(item => item.ConfigID == configId && listOfGuaranteeIds.Contains(item.QuestionID)).Select(i => i.QuestionID).ToArray(); // var gt = context.tbl_HVAC_ConfigGuaranteeTexts.Where(item => item.ConfigID == configId).ToList(); // var texts = new GuaranteeModel[listOfselectedGuarantees.Length]; // for (var i = 0; i < texts.Length; ++i) // { // var grId = listOfselectedGuarantees[i]; // var gr = context.tbl_HVAC_Guarantees.Single(item => item.GuaranteeID == grId); // texts[i] = new GuaranteeModel // { // Id = gr.GuaranteeID, // GuaranteeName = gr.GuaranteeName, // GuaranteeText = "" // }; // if (gt.Any(item => item.GuaranteeID == gr.GuaranteeID)) // { // texts[i].GuaranteeText = gt.Single(item => item.GuaranteeID == gr.GuaranteeID).GuaranteeText; // } // } // return texts; //} public ActionResult GetGuarantee(GuaranteeModel g) { return(PartialView(g)); }