示例#1
0
        async Task SavePhotoToDatabase()
        {
            var photoModel = new PhotoModel
            {
                InspectionModelId   = _inspectionId,
                ImageName           = PhotoImageNameText,
                ImageAsBase64String = ConvertStreamToBase64String(PhotoMediaFile.GetStream())
            };

            await InspectionModelDatabase.SavePhoto(photoModel);
        }
        public static async Task <int> SavePhoto(PhotoModel photoModel)
        {
            if (!_isDatabaseInitialized)
            {
                await InitializeDatabase();
            }

            if (await GetPhoto(photoModel.Id) != null)
            {
                await _databaseConnection?.UpdateAsync(photoModel);

                return(photoModel.Id);
            }

            return(await _databaseConnection?.InsertAsync(photoModel));
        }
示例#3
0
        public static async Task <int> SavePhoto(PhotoModel photoModel)
        {
            var databaseConnection = await GetDatabaseConnectionAsync();

            return(await databaseConnection?.InsertOrReplaceAsync(photoModel));
        }