-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathBody.cs
More file actions
27 lines (26 loc) · 709 Bytes
/
Copy pathBody.cs
File metadata and controls
27 lines (26 loc) · 709 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
using System;
using convertroman.contracts;
using convertroman.conversions;
namespace convertroman.body
{
public class Body : IBody
{
public void Convert(string number, Action<string> onSuccess, Action<string> onError) {
RomanConversions.Determine_number_type (number,
romanNumber =>
RomanConversions.Validate_roman_number(romanNumber,
() => {
var result = FromRomanConversion.Convert(romanNumber);
onSuccess(result.ToString());
},
onError),
arabicNumber =>
RomanConversions.Validate_arabic_number(arabicNumber,
() => {
var result = ToRomanConversion.Convert(arabicNumber);
onSuccess(result);
},
onError));
}
}
}