diff options
author | Donatas Adamonis <dona0169@edu.easj.dk> | 2017-05-03 20:56:33 +0200 |
---|---|---|
committer | Donatas Adamonis <dona0169@edu.easj.dk> | 2017-05-03 20:56:33 +0200 |
commit | e81fed964456abe25076661b339fb0572d6499bf (patch) | |
tree | 3517dcbde202726af8d670377068cbbca9a90ad4 | |
parent | 6fd7dd5064f5baed732976b0cfc47101ae52f783 (diff) | |
parent | 4fe698a03dcb6635261a68d39bb9d5f91e1f3eb6 (diff) |
Merge branch 'master' of https://github.com/MarcinZelent/ApartmentAdmin
-rw-r--r-- | ApartmentManager/HousingWebAPI/Controllers/UsersController.cs | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/ApartmentManager/HousingWebAPI/Controllers/UsersController.cs b/ApartmentManager/HousingWebAPI/Controllers/UsersController.cs index af3ac1d..098c97a 100644 --- a/ApartmentManager/HousingWebAPI/Controllers/UsersController.cs +++ b/ApartmentManager/HousingWebAPI/Controllers/UsersController.cs @@ -23,18 +23,18 @@ namespace HousingWebApi.Controllers } // GET: api/Users/by-username/username - //[ResponseType(typeof(User))] - //[Route("api/Users/by-username/{username:string}")] - //public IHttpActionResult GetUserByUsername(string username) - //{ - // User user = db.Users.Find(username); - // if (user == null) - // { - // return NotFound(); - // } - - // return Ok(user); - //} + [ResponseType(typeof(User))] + [Route("api/Users/by-username/{username}")] + public IHttpActionResult GetUserByUsername(string username) + { + User user = db.Users.SingleOrDefault(u => u.Username == username); + if (user == null) + { + return NotFound(); + } + + return Ok(user); + } // GET: api/Users/5 [ResponseType(typeof(User))] |