private async Task DoFileUpload(int dogNoteId, IEnumerable <HttpPostedFileBase> files) { if (dogNoteId == 0) { return; } if (files == null) { return; } var dogNoteAttachments = new List <DogNoteAttachment>(); foreach (var file in files) { var blobKey = Guid.NewGuid(); var dogNoteAttachment = new DogNoteAttachment { BlobKey = blobKey, DogNoteID = dogNoteId, MimeType = file.ContentType, FileName = file.FileName, FileExtension = Path.GetExtension(file.FileName) }; dogNoteAttachments.Add(dogNoteAttachment); await _blobRepo.InsertOrUpdateImageAsync(blobKey.ToString(), file.InputStream); } _dogNoteAttachmentRepo.Insert(dogNoteAttachments); }
private async Task UploadFiles(int dogNoteId, IEnumerable <HttpPostedFileBase> files) { var dogNoteAttachments = new List <DogNoteAttachment>(); foreach (var file in files) { var blobKey = Guid.NewGuid(); var dogNoteAttachment = new DogNoteAttachment { BlobKey = blobKey, DogNoteID = dogNoteId, MimeType = file.ContentType }; dogNoteAttachments.Add(dogNoteAttachment); await _blobRepo.InsertOrUpdateImageAsync(blobKey.ToString(), file.InputStream); } _dogNoteAttachmentRepo.Insert(dogNoteAttachments); }