From b31e2799c8ab431a0aaf1477f97c3885d94329a9 Mon Sep 17 00:00:00 2001 From: marcinzelent Date: Wed, 3 May 2017 20:08:32 +0200 Subject: Added method for getting user by username. --- .../HousingWebAPI/Controllers/UsersController.cs | 24 +++++++++++----------- 1 file 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))] -- cgit v1.2.3 From 724670b37f15a928b69680c3b80b4ec3cbe86506 Mon Sep 17 00:00:00 2001 From: DonatasAd Date: Wed, 3 May 2017 20:52:40 +0200 Subject: delete faking database --- HousingDatabase.ldf | Bin 8388608 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 HousingDatabase.ldf diff --git a/HousingDatabase.ldf b/HousingDatabase.ldf deleted file mode 100644 index 80e00d5..0000000 Binary files a/HousingDatabase.ldf and /dev/null differ -- cgit v1.2.3 From 4fe698a03dcb6635261a68d39bb9d5f91e1f3eb6 Mon Sep 17 00:00:00 2001 From: DonatasAd Date: Wed, 3 May 2017 20:53:18 +0200 Subject: delete faking database 2 --- HousingDatabase.mdf | Bin 8388608 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 HousingDatabase.mdf diff --git a/HousingDatabase.mdf b/HousingDatabase.mdf deleted file mode 100644 index 9fb615b..0000000 Binary files a/HousingDatabase.mdf and /dev/null differ -- cgit v1.2.3