forked from mwherman2000/csharp-smart-contract-workshop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlab4_processoperationpattern.cs
51 lines (47 loc) · 1.36 KB
/
lab4_processoperationpattern.cs
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
using Neo.SmartContract.Framework;
using Neo.SmartContract.Framework.Services.Neo;
using System;
using System.Numerics;
namespace lab4_processoperationpattern
{
public class lab4_processoperationpattern : SmartContract
{
public static object Main(string operation, params object[] args)
{
object result = false; // = 0 (zero)
if (args.Length == 0)
{
Runtime.Log("Missing parameters");
result = false;
}
else
{
if (operation == "query")
{
Runtime.Notify("query", args[0]);
result = args[0];
}
else if (operation == "delete")
{
Runtime.Notify("delete", args[0]);
result = true;
}
else if (operation == "register")
{
Runtime.Notify("register", args[0]);
result = true;
}
else if (operation == "transfer")
{
Runtime.Notify("transfer", args[0]);
result = true;
}
else
{
result = false;
}
}
return result;
}
}
}