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")); }
public void Post([FromBody] Iguana item) { _iguanaTrackerService.Add(item); }