Exemple #1
0
        public static MongoGridFSFileInfo UploadImageToDish(this Dish dishWithImages, MongoGridFS gridFS, System.IO.Stream fs, string imageName, string contentType)
        {
            log.DebugFormat("[UploadImageToDish] This RestaurantBasicData.Id={0}, MongoGridFS, imageName={1}, contentType={2}.", dishWithImages.Id, gridFS.ToString(), imageName, contentType);

            MongoGridFSCreateOptions gridFSOption = new MongoGridFSCreateOptions();
            gridFSOption.ContentType = contentType;
            var gridFsInfo = gridFS.Upload(fs, imageName, gridFSOption);
            ImageData convertedValue = ImageServices.ConvertToImageData(gridFsInfo);
            dishWithImages.Image = convertedValue;
            //dishWithImages.Images[0] = convertedValue;
            var fileId = gridFsInfo.Id;
            return gridFsInfo;
        }
Exemple #2
0
        public static MongoGridFSFileInfo UploadImageToDish(this Dish dishWithImages, MongoGridFS gridFS, System.IO.Stream fs, string imageName)
        {
            //resize picture 100 * 100
            //save to profile
            //on output implement logic of presentation  - if we have image let's display it
            //copy all images that we have on links to gridFS
            //Upload images from backoffice.

            log.DebugFormat("[UploadImageToDish] This RestaurantBasicData.Id={0}, MongoGridFS, imageName={1}.", dishWithImages.Id, gridFS.ToString(), imageName);

            var gridFsInfo = gridFS.Upload(fs, imageName);
            ImageData convertedValue = ImageServices.ConvertToImageData(gridFsInfo);
            dishWithImages.Image = convertedValue;
            var fileId = gridFsInfo.Id;
            return gridFsInfo;
        }