-
Notifications
You must be signed in to change notification settings - Fork 0
/
Contact.aspx.cs
77 lines (61 loc) · 1.88 KB
/
Contact.aspx.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Web;
using System.Web.Services;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebFormVueExample
{
public partial class Contact : Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
#region Empl List Example
public class Employee
{
public string firstName { get; set; }
public string lastName { get; set; }
public string email { get; set; }
public string role { get; set; }
}
[WebMethod]
public static List<Employee> GetEmpList()
{
var empList = new List<Employee>(){
new Employee { firstName="Ramon", lastName="Pardo", email="[email protected]",role="HR"},
new Employee { firstName="Luis", lastName="García", email="[email protected]",role="IT"}
};
return empList;
}
#endregion
#region Company Example
public class Company
{
public string companyName { get; set; }
public string location { get; set; }
}
[WebMethod]
public static Company GetCompany()
{
return new Company { companyName = "MyCompanyName", location = "Puerto Rico" };
}
[WebMethod]
public static object InsertCompany(Company company)
{
try
{
Console.WriteLine(company);
return new { requestStatus = 200, data = company };
//return new { requestStatus = 400, data = "Error Message!" };
}
catch (Exception ex)
{
return new { requestStatus = 400, data = "Error Message!" + ex.ToString() };
}
}
#endregion
}
}