private static async Task SetRoutes(RootForm state, Field <RootForm> field) { switch (state.Destination) { case Destination.Kilimangiaro: field .AddDescription("Machame", "Machame Route") .AddTerms("Machame", "machame route", "machame") .AddDescription("Marangu", "Marangu Route") .AddTerms("Marangu", "marangu route", "marangu") .AddDescription("Lemosho", "Lemosho Route") .AddTerms("Lemosho", "lemosho route", "lemosho"); break; case Destination.Himalaya: field .AddDescription("PoonHill", "Poon Hill and the Annapurna Base Camp") .AddTerms("PoonHill", "poon hill", "poon", "annapurna") .AddDescription("Everest", "Everest Base Camp") .AddTerms("Everest", "everest base camp", "everest") .AddDescription("UpperMustang", "Upper Mustang Trek") .AddTerms("UpperMustang", "upper mustang trek", "upper mustang", "mustang"); break; } }
private static async Task <ValidateResult> ValidatePeople(RootForm state, object response) { var result = new ValidateResult { IsValid = true, Value = response }; if (Convert.ToInt32(response) < 1) { result.Feedback = "There should be at least 1 person."; result.IsValid = false; } else if (Convert.ToInt32(response) > 10) { result.Feedback = "I can accept maximum 10 people."; result.IsValid = false; } return(result); }
private static async Task <decimal> CalculatePrice(RootForm state) { decimal price = 0.0m; switch (state.Destination) { case Destination.Kilimangiaro: price = 1000.0m; break; case Destination.Himalaya: price = 1500.0m; break; case Destination.Andes: price = 1800.0m; break; } price += 200.0m * state.Experiences.Count; price *= state.GroupType == GroupType.SoloTraveler || state.GroupType == GroupType.Couple ? (int)state.GroupType : state.HowManyPeople; return(price); }