-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWebService1.asmx.cs
More file actions
59 lines (55 loc) · 1.78 KB
/
WebService1.asmx.cs
File metadata and controls
59 lines (55 loc) · 1.78 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
52
53
54
55
56
57
58
59
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
namespace CodingCafeWebApplication
{
/// <summary>
/// Summary description for WebService1
/// </summary>
[WebService(Namespace = "http://WebServicePractive.com/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
// [System.Web.Script.Services.ScriptService]
public class WebService1 : System.Web.Services.WebService
{
[WebMethod]
public string HelloWorld()
{
return "Hello World";
}
public enum CalculationType
{
Sum = 1,
Subtract = 2,
Multiply = 3,
Division = 4
}
[WebMethod(Description ="Simple calculator Web Service.")]
public decimal Calculate(decimal decValue1, decimal decValue2, CalculationType calculationType)
{
decimal decResult;
switch (calculationType)
{
case CalculationType.Sum:
decResult = decValue1 + decValue2;
break;
case CalculationType.Subtract:
decResult = decValue1 - decValue2;
break;
case CalculationType.Multiply:
decResult = decValue1 * decValue2;
break;
case CalculationType.Division:
decResult = decValue1 % decValue2;
break;
default:
decResult = 0;
break;
}
return decResult;
}
}
}