void ReleaseDesignerOutlets() { if (animalFoto != null) { animalFoto.Dispose(); animalFoto = null; } if (ImageAnimal != null) { ImageAnimal.Dispose(); ImageAnimal = null; } if (labelAnimalName != null) { labelAnimalName.Dispose(); labelAnimalName = null; } if (labelName != null) { labelName.Dispose(); labelName = null; } if (NameAnimalID != null) { NameAnimalID.Dispose(); NameAnimalID = null; } if (starsLayout != null) { starsLayout.Dispose(); starsLayout = null; } if (viewID != null) { viewID.Dispose(); viewID = null; } if (whoKillMe != null) { whoKillMe.Dispose(); whoKillMe = null; } }
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")); }