-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIService1.cs
More file actions
53 lines (48 loc) · 2 KB
/
IService1.cs
File metadata and controls
53 lines (48 loc) · 2 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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
namespace StackoverServiceTestnet
{
// NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IService1" in both code and config file together.
[ServiceContract]
[CustContractBehavior]
public interface IService1
{
[OperationContract]
[WebInvoke(Method = "GET", UriTemplate = "user/{name}", ResponseFormat = WebMessageFormat.Json)]
Result GetUserData(string name);
[OperationContract]
[WebInvoke(Method = "POST", UriTemplate = "user", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
Result PostUserData(UserData user);
[OperationContract]
[WebInvoke(Method = "PUT", UriTemplate = "user", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
Result PutUserData(UserData user);
[OperationContract]
[WebInvoke(Method = "DELETE", UriTemplate = "user", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
Result DeleteUserData(UserData user);
}
[DataContract(Name = "user")]
public class UserData
{
[DataMember(Name = "Name")]
public string Name { get; set; }
[DataMember(Name = "Password")]
public string Password { get; set; }
[DataMember(Name = "Email")]
public string Email { get; set; }
}
[DataContract(Name = "Result")]
public class Result
{
[DataMember(Name = "Stu")]
public string Stu { get; set; }
[DataMember(Name = "Code")]
public int Code { get; set; }
[DataMember(Name = "UserData")]
public UserData userData { get; set; }
}
}