diff options
author | Donatas Adamonis <dona0169@edu.easj.dk> | 2017-05-10 10:45:43 +0200 |
---|---|---|
committer | Donatas Adamonis <dona0169@edu.easj.dk> | 2017-05-10 10:45:43 +0200 |
commit | 5f31eabf99bfce7f39bb205bfec97ab232c28394 (patch) | |
tree | 0b6c93b3764bca948a2fa1971bb088207d8a7cce | |
parent | dfae63b5e9d20a4a94489e2b45c3b907896bb4fc (diff) |
api/resident/1
-rw-r--r-- | ApartmentManager/HousingWebApi/Controllers/ResidentsController.cs | 42 | ||||
-rw-r--r-- | ApartmentManager/HousingWebApi/Models/ResidentList.cs | 2 |
2 files changed, 22 insertions, 22 deletions
diff --git a/ApartmentManager/HousingWebApi/Controllers/ResidentsController.cs b/ApartmentManager/HousingWebApi/Controllers/ResidentsController.cs index 65e796a..9cd3932 100644 --- a/ApartmentManager/HousingWebApi/Controllers/ResidentsController.cs +++ b/ApartmentManager/HousingWebApi/Controllers/ResidentsController.cs @@ -34,27 +34,27 @@ namespace HousingWebApi.Controllers return Ok(resident); } - // GET: api/Residents/1 - - //[Route("api/ApartmentResidents/{id}")] - //[ResponseType(typeof(ResidentList))] - //public IQueryable<ResidentList> GetResidents(int id) - //{ - // var roomlist = from resident in db.Residents - // where (resident.ApartmentNr == id) - // select new ResidentList - // { - // ResidentNr = resident.ResidentNr, - // ApartmentNr = resident.ApartmentNr, - // FirstName = resident.FirstName, - // LastName = resident.LastName, - // BirthDate = resident.BirthDate, - // Phone = resident.Phone, - // Email = resident.Email, - // Picture = resident.Picture - // }; - // return roomlist; - //} + //GET: api/Residents/1 + + [Route("api/ApartmentResidents/{id}")] + [ResponseType(typeof(ResidentList))] + public IQueryable<ResidentList> GetResidents(int id) + { + var roomlist = from resident in db.Residents + where (resident.ApartmentNr == id) + select new ResidentList + { + ResidentNr = resident.ResidentNr, + ApartmentNr = resident.ApartmentNr, + FirstName = resident.FirstName, + LastName = resident.LastName, + BirthDate = resident.BirthDate, + Phone = resident.Phone, + Email = resident.Email, + Picture = resident.Picture + }; + return roomlist; + } // PUT: api/Residents/5 [ResponseType(typeof(void))] diff --git a/ApartmentManager/HousingWebApi/Models/ResidentList.cs b/ApartmentManager/HousingWebApi/Models/ResidentList.cs index 1fd4b30..9423bc1 100644 --- a/ApartmentManager/HousingWebApi/Models/ResidentList.cs +++ b/ApartmentManager/HousingWebApi/Models/ResidentList.cs @@ -14,7 +14,7 @@ namespace HousingWebApi public DateTime? BirthDate { get; set; } public int? Phone { get; set; } public string Email { get; set; } - public byte[] Picture { get; set; } + public string Picture { get; set; } } }
\ No newline at end of file |