diff options
-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 |