roadie/RoadieApi/Controllers/ReleaseController.cs

63 lines
2.2 KiB
C#
Raw Normal View History

2018-11-02 16:04:49 -05:00
using Mapster;
using Microsoft.AspNet.OData;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Roadie.Library.Caching;
using Roadie.Library.Data;
using System;
using System.Linq;
2018-11-05 20:41:51 -06:00
using models = Roadie.Library.Models;
2018-11-02 16:04:49 -05:00
namespace Roadie.Api.Controllers
{
[Produces("application/json")]
[Route("release")]
[ApiController]
[Authorize]
public class ReleaseController : EntityControllerBase
{
2018-11-06 22:33:22 -06:00
public ReleaseController(ILoggerFactory logger, ICacheManager cacheManager, IConfiguration configuration)
: base(cacheManager, configuration)
2018-11-02 16:04:49 -05:00
{
this._logger = logger.CreateLogger("RoadieApi.Controllers.ReleaseController"); ;
}
2018-11-06 22:33:22 -06:00
//[EnableQuery]
//public IActionResult Get()
//{
// return Ok(this._RoadieDbContext.Releases.ProjectToType<models.Releases.Release>());
//}
2018-11-02 16:04:49 -05:00
2018-11-06 22:33:22 -06:00
//[HttpGet("{id}")]
//[ProducesResponseType(200)]
//[ProducesResponseType(404)]
//public IActionResult Get(Guid id)
//{
// var key = id.ToString();
// var result = this._cacheManager.Get<models.Releases.Release>(key, () =>
// {
// var d = this._RoadieDbContext
// .Releases
// .Include(x => x.Artist)
// .Include(x => x.Labels).Include("Labels.Label")
// .Include(x => x.Medias).Include("Medias.Tracks")
// .Include(x => x.Genres).Include("Genres.Genre")
// .Include(x => x.Collections).Include("Collections.Collection")
// .FirstOrDefault(x => x.RoadieId == id);
// if (d != null)
// {
// return d.Adapt<models.Releases.Release>();
// }
// return null;
// }, key);
// if (result == null)
// {
// return NotFound();
// }
// return Ok(result);
//}
2018-11-02 16:04:49 -05:00
}
}