-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathAWSS3Controller.cs
More file actions
36 lines (34 loc) · 1.06 KB
/
Copy pathAWSS3Controller.cs
File metadata and controls
36 lines (34 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using System.Collections.Generic;
using System.Threading.Tasks;
using BervProject.WebApi.Boilerplate.Services.AWS;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Http;
namespace BervProject.WebApi.Boilerplate.Controllers
{
[ApiController]
[Route("api/v{version:apiVersion}/[controller]")]
[ApiVersion("1.0")]
public class SThreeController : ControllerBase
{
private readonly IAwsS3Service _awsS3Service;
public SThreeController(IAwsS3Service awsS3Service)
{
_awsS3Service = awsS3Service;
}
/// <summary>
/// Upload to S3
/// </summary>
/// <param name="file"></param>
/// <returns></returns>
[HttpPost("upload")]
[ProducesResponseType(typeof(Dictionary<string, string>), StatusCodes.Status200OK)]
public async Task<IActionResult> Upload([FromForm] IFormFile file)
{
var result = await _awsS3Service.UploadFile(file);
return Ok(new
{
path = result
});
}
}
}