Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
added get employee
- Loading branch information
Jeremy Mill
committed
Dec 10, 2015
1 parent
c95eb9d
commit adf00cf
Showing
4 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
TeamDBAwesome/TeamDBAwesome/Controllers/GetEmployeeController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Net; | ||
using System.Net.Http; | ||
using System.Web.Http; | ||
using TeamDBAwesome.Models; | ||
using TeamDBAwesome.SqlService; | ||
using Newtonsoft.Json; | ||
|
||
namespace TeamDBAwesome.Controllers | ||
{ | ||
public class GetEmployeeController : ApiController | ||
{ | ||
public HttpResponseMessage Get(int personId) | ||
{ | ||
HttpResponseMessage message = new HttpResponseMessage(HttpStatusCode.OK); | ||
MySqlService sql = new MySqlService(); | ||
employee emp = sql.GetEmployee(personId); | ||
string json = JsonConvert.SerializeObject(emp); | ||
message.Content = new StringContent(json); | ||
return message; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Web; | ||
|
||
namespace TeamDBAwesome.Models | ||
{ | ||
public class employee | ||
{ | ||
public int employeeid { get; set; } | ||
public string title { get; set; } | ||
public string firstname { get; set; } | ||
public string lastname { get; set; } | ||
public string email { get; set; } | ||
public bool isAdmin { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters