public async Task <IActionResult> OnPost() { var prod = await _product.GetProduct(ID.GetValueOrDefault()) ?? new Product(); prod.Name = Product.Name; prod.Price = Product.Price; prod.Description = Product.Description; if (ImageStuffedAnimal != null) { var filePath = Path.GetTempFileName(); using (var stream = new FileStream(filePath, FileMode.Create)) { await ImageStuffedAnimal.CopyToAsync(stream); } var container = await BlobImage.GetContainer("wildplanetimages"); BlobImage.UploadFile(container, ImageStuffedAnimal.FileName, filePath); CloudBlob blob1 = await BlobImage.GetBlob(ImageStuffedAnimal.FileName, container.Name); prod.ImageStuffedAnimal = blob1.Uri.ToString(); } if (ImageAnimal != null) { var filePath = Path.GetTempFileName(); using (var stream = new FileStream(filePath, FileMode.Create)) { await ImageAnimal.CopyToAsync(stream); } var container = await BlobImage.GetContainer("wildplanetimages"); BlobImage.UploadFile(container, ImageAnimal.FileName, filePath); CloudBlob blob2 = await BlobImage.GetBlob(ImageAnimal.FileName, container.Name); prod.ImageAnimal = blob2.Uri.ToString(); } prod.Summary = Product.Summary; prod.AmmountLeft = Product.AmmountLeft; await _product.UpdateProduct(prod); return(RedirectToPage("ProductManagement")); }