public async void Post([FromBody]ImageMediaModels value, string diagramid)
{
string ImageName = value.FileName.ToLower();
string UserId = UserHelper.GetCurrentUserID().ToLower();
string DiagramId = diagramid.ToLower();
string Blobname = UserId + "/" + DiagramId + "/" + ImageName;
MemoryStream stream = new MemoryStream(value.Buffer);
try
{
if (!BlobManager.ImageExists(Blobname))
{
await BlobManager.UploadImage(stream, Blobname);
}
}
catch (Exception Ex)
{
string Err = string.Format("Unable to upload the image {0}", value.FileName);
var response = Request.CreateErrorResponse(HttpStatusCode.InternalServerError, Err);
response.Content.Headers.ContentType = new MediaTypeHeaderValue("text/html");
Log.LogError("ImageAPI: Unable to upload image {0}, Error: {1}", value.FileName, Ex.Message);
throw new HttpResponseException(response);
}
}