Exemple #1
0
        public ImageItem InsertImage(string albumId, ImageItem image)
        {
            var imageAdapter = new ImageAdapter();

            image = imageAdapter.Insert(image);
            var param = new[]
            {
                new SqlParameter("@albumId", albumId),
                new SqlParameter("@imageId", image.Id),
            };

            Call(SP_ALBUM_IMAGE_INSERT, param);
            return(image);
        }
Exemple #2
0
        public List <PhotoAlbum> GetByHouseId(string houseId)
        {
            var param = new[]
            {
                new SqlParameter("@houseId", houseId),
            };
            var albums = Call(SP_PHOTO_ALBUM_GETBYHOUSEID, param, DataReader.ReadAlbum);

            foreach (var album in albums)
            {
                var imageAdapter = new ImageAdapter();
                album.Items = imageAdapter.GetByAlbumId(album.Id);
            }
            return(albums);
        }
Exemple #3
0
        public PhotoAlbum GetById(string id)
        {
            var param = new[]
            {
                new SqlParameter("@id", id),
            };
            var album = Call(SP_PHOTO_ALBUM_GETBYID, param, DataReader.ReadAlbum).FirstOrDefault();

            if (album != null)
            {
                var imageAdapter = new ImageAdapter();
                album.Items = imageAdapter.GetByAlbumId(album.Id);
            }
            return(album);
        }
Exemple #4
0
        public ImageItem InsertImage(string roomTypeId, ImageItem image)
        {
            var imageAdapter = new ImageAdapter();

            image = imageAdapter.Insert(image);

            var param = new[]
            {
                new SqlParameter("@imageId", image.Id),
                new SqlParameter("@roomTypeId", roomTypeId),
            };

            Call(SP_ROOMTYPEIMAGE_INSERT, param);
            return(image);
        }
Exemple #5
0
        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);
        }
Exemple #6
0
        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);
        }