1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- using System.Threading.Tasks;
- using GxPress.Auth;
- using GxPress.Repository.Interface.Media;
- using GxPress.Result.Media;
- using GxPress.Service.Interface.Media;
- using Microsoft.AspNetCore.Authorization;
- using Microsoft.AspNetCore.Http;
- using Microsoft.AspNetCore.Mvc;
- namespace GxPress.Api.WebControllers
- {
- /// <summary>
- /// 媒体
- /// </summary>
- [Route("api/web/media")]
- [ApiController]
- [Authorize]
- public class WebMediaController : Controller
- {
- private readonly IMediaRepository mediaRepository;
- private readonly ILoginContext _loginContext;
- private readonly IMediaService mediaService;
- private readonly IHttpContextAccessor httpContextAccessor;
- public WebMediaController(IMediaRepository mediaRepository, ILoginContext _loginContext, IMediaService mediaService, IHttpContextAccessor httpContextAccessor)
- {
- this.mediaRepository = mediaRepository;
- this._loginContext = _loginContext;
- this.mediaService = mediaService;
- this.httpContextAccessor = httpContextAccessor;
- }
- /// <summary>
- /// 详情
- /// </summary>
- /// <param name="id"></param>
- /// <returns></returns>
- [HttpGet("{id}")]
- [AllowAnonymous]
- public async Task<MediaResult> GetAsync(int id)
- {
-
- return await mediaService.GetAsync(id);
- }
- }
- }
|