Пример #1
0
        public IActionResult AddSighting(Iguana iguana)
        {
            //https://www.codegrepper.com/code-examples/csharp/how+to+convert+iformfile+to+byte+array+c%23
            if (ModelState.IsValid)
            {
                string filePath = string.Format("{0}{1}", iguana.Directory, iguana.ImageFileName);

                BlobHttpHeaders blobHttpHeader = new BlobHttpHeaders();
                blobHttpHeader.ContentType = "image/jpeg";

                _azureBlobService.UploadFileToStorage(iguana.ImageData, filePath, blobHttpHeader);

                _iguanaTrackerService.Add(iguana);
            }

            return(RedirectToAction("Index"));
        }