-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathCalculatorService.cs
More file actions
51 lines (46 loc) · 1.74 KB
/
CalculatorService.cs
File metadata and controls
51 lines (46 loc) · 1.74 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
namespace CoreWcf.Samples.TokenAuthenticator
{
// Service class which implements the service contract interface.
// Added code to write output to the console window
public class CalculatorService : ICalculatorService
{
private static void DisplayIdentityInformation()
{
Console.WriteLine("\t\tSecurity context identity : {0}", ServiceSecurityContext.Current.PrimaryIdentity.Name);
}
public double Add(double n1, double n2)
{
DisplayIdentityInformation();
double result = n1 + n2;
Console.WriteLine("Received Add({0},{1})", n1, n2);
Console.WriteLine("Return: {0}", result);
return result;
}
public double Subtract(double n1, double n2)
{
DisplayIdentityInformation();
double result = n1 - n2;
Console.WriteLine("Received Subtract({0},{1})", n1, n2);
Console.WriteLine("Return: {0}", result);
return result;
}
public double Multiply(double n1, double n2)
{
DisplayIdentityInformation();
double result = n1 * n2;
Console.WriteLine("Received Multiply({0},{1})", n1, n2);
Console.WriteLine("Return: {0}", result);
return result;
}
public double Divide(double n1, double n2)
{
DisplayIdentityInformation();
double result = n1 / n2;
Console.WriteLine("Received Divide({0},{1})", n1, n2);
Console.WriteLine("Return: {0}", result);
return result;
}
}
}