static void Main(string[] args) { var emailResult = UnverifiedEmail.Create("*****@*****.**"); emailResult.Match( Succ: email => { SendResetPasswordLink(email); Console.WriteLine("Email address is valid."); return(Unit.Default); }, Fail: ex => { Console.WriteLine($"Invalid email address. Reason: {ex.Message}"); return(Unit.Default); } ); var replayResult = UnvalidateReplay.CreateBody("MyRespondForQuestion"); replayResult.Match( Succ: replay => { ReplayComplete(replay); Console.WriteLine("Replay address is valid."); return(Unit.Default); }, Fail: ex => { Console.WriteLine($"Invalid replay address. Reason: {ex.Message}"); return(Unit.Default); } ); Console.ReadLine(); }
private static void ReplayComplete(UnvalidateReplay body) { var validateReplayResult = new VerifyReplayService().VerifyReplay(body); validateReplayResult.Match( validateReplay => { new SendNotify(123, 4, "ReplayMessageForQuestion", "*****@*****.**", 156, "You have a new replay for question"); new SendNotify(123, 4, "ReplayMessageForQuestion", "*****@*****.**", 156, "Your Replay has posted"); new ReplayPublished(123, "ReplayMessageForQuestion"); return(Unit.Default); }, ex => { new SendNotify(123, 4, "ReplayMessageForQuestion", "*****@*****.**", 156, "Your Replay cannot be posted. Try again using the help manual"); Console.WriteLine(" Replay question could not be verified"); return(Unit.Default); } ); }
public Result <ValidateReplay> VerifyReplay(UnvalidateReplay body) { return(new ValidateReplay(body.Body)); }