public async Task <IActionResult> UploadEquipmentMediaAsync(DetailsViewModel model)
        {
            foreach (IFormFile file in model.UploadMedia.MediaFiles)
            {
                string blobName = $"{Guid.NewGuid()}_{file.FileName}";
                string uri      = await __BlobService.UploadFormFile(file, blobName);

                if (!string.IsNullOrWhiteSpace(uri))
                {
                    BlobResponse _BlobResponse = await __BlobManager.CreateAsync(new CreateBlobRequest
                    {
                        Name = blobName,
                        Path = uri
                    });

                    await __EquipmentBlobManager.CreateAsync(new CreateEquipmentBlobRequest
                    {
                        EquipmentUID = model.UploadMedia.EquipmentUID,
                        BlobUID      = _BlobResponse.UID
                    });
                }
            }

            return(Redirect(Request.Headers["Referer"].ToString()));
        }
Example #2
0
        private async Task UploadEquipmentMediaAsync(IFormFile file, Guid equipmentUID)
        {
            string blobName = $"{Guid.NewGuid()}_{file.FileName}";
            string uri      = await __BlobService.UploadFormFile(file, blobName);

            if (!string.IsNullOrWhiteSpace(uri))
            {
                BlobResponse _BlobResponse = await __BlobManager.CreateAsync(new CreateBlobRequest
                {
                    Name = blobName,
                    Path = uri
                });

                await __EquipmentBlobManager.CreateAsync(new CreateEquipmentBlobRequest
                {
                    EquipmentUID = equipmentUID,
                    BlobUID      = _BlobResponse.UID
                });
            }
        }