public static string CreditBlock(decimal price) { var txt = Htmls.HtmlBlock(HtmlBlocks.CreditCoursePage); var paymentTxt = CreditMinPayment(price); return(txt.GetOrDefault(x => x.Replace("[Payment]", paymentTxt))); }
public SimpleTest Parse(int id, SimpleTest.Blocks blocks) { var pairs = GetPairs(Htmls.HtmlBlock(blocks.Questions)); var questions = pairs.Aggregate(new List <SimpleTest.Question>(), (sl, t) => { if (t.Item1 == q) { sl.Add(new SimpleTest.Question(t.Item2)); } else if (t.Item1 == a) { sl.Last().Answers.Add(new SimpleTest.Answer { Text = t.Item2 }); } else if (t.Item1 == i) { sl.Last().Image = t.Item2; } return(sl); }); var results = GetPairs(Htmls.HtmlBlock(blocks.Result)).Aggregate(new List <SimpleTest.Result>(), (sl, t) => { if (t.Item1 == r) { sl.Add(new SimpleTest.Result() { Text = t.Item2 }); } else if (t.Item1 == c) { sl.Last().Courses = t.Item2; } return(sl); }); return(new SimpleTest(id) { Name = blocks.Name, Description = Htmls.HtmlBlock(blocks.Description), Questions = questions, Results = results }); }