public List <RoomType> GetByHouseId(string houseId) { var param = new[] { new SqlParameter("@houseId", houseId), }; var roomTypes = Call(SP_ROOMTYPE_GETBYHOUSEID, param, DataReader.ReadRoomType); var imageAdapter = new ImageAdapter(); foreach (var roomType in roomTypes) { roomType.Images = imageAdapter.GetByRoomTypId(roomType.Id); } return(roomTypes); }
public RoomType GetById(string id) { var param = new[] { new SqlParameter("@id", id), }; var roomType = Call(SP_ROOMTYPE_GETBYID, param, DataReader.ReadRoomType).FirstOrDefault(); if (roomType == null) { return(null); } var articleAdapter = new ArticleAdapter(); roomType.Article = articleAdapter.GetById(roomType.Article.Id); var imageAdapter = new ImageAdapter(); roomType.Images = imageAdapter.GetByRoomTypId(id); return(roomType); }