Esempio n. 1
0
        public async Task <int> AddPhotoToRecord(IDataItemWithSinglePhoto record, List <IFormFile> files)
        {
            if (files.Count() > 1)
            {
                _logger.LogError("This record can have only one photo");
                return(0);
            }
            List <string> errors       = new List <string>();
            var           addingPhotos = this.savePhotosToStorage(record, files, true, true);

            if (addingPhotos.Count == 0)
            {
                return(0);
            }

            //Delete current photo
            if (record.Photo != null)
            {
                var deletingResult = this._imageFileStorageManager.DeleteImageFile(record.Photo);
                if (!string.IsNullOrEmpty(deletingResult.Error))
                {
                    this._logger.LogError(deletingResult.Error);
                }
                Delete(record.Photo);
                await SaveAll();
            }

            record.Photo = addingPhotos[0];
            await SaveAll();

            return(addingPhotos.Count());
        }
Esempio n. 2
0
 public Task <int> AddPhotoToRecord(IDataItemWithSinglePhoto record, List <IFormFile> files)
 {
     throw new System.NotImplementedException();
 }