// [TypeFilter(typeof(ValidateCommunityUserFilterAttribute))] public async Task <IActionResult> Put(int communityId, IFormFile file) { if (file == null && Request.Form.Files.Count == 0) { return(BadRequest("Files missing from request.")); } file = file ?? Request.Form.Files[0]; using (var ms = new MemoryStream()) { await file.CopyToAsync(ms); ms.Position = 0; var newFilename = await azureBlobStorageService.PutBlob(file.FileName, ms.ReadAllBytes()); var response = CreatedAtAction(nameof(GetAsync), new { communityId, filename = newFilename }, new { filename = azureBlobStorageService.GetImageUrl(newFilename) }); return(response); } }