Created
September 25, 2020 14:15
-
-
Save bjornmicallef/45193564b6109b9b6473821928c0112d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Route("api/[controller]")] | |
[ApiController] | |
public class ImagesController : ControllerBase | |
{ | |
private readonly IImageService _imageService; | |
public ImagesController(IImageService imageService) | |
{ | |
_imageService = imageService; | |
} | |
// POST api/images | |
[HttpPost] | |
public async Task<IActionResult> PostAsync([FromForm] ImageDetailsDto imageDetails) | |
{ | |
var requestImage = Request.Form.Files.FirstOrDefault(); | |
var result = await _imageService.SaveImage(imageDetails.UserId, requestImage); | |
// save user details in some other service | |
return Ok(result); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment