using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using JCSoft.WX.Framework.Api; using Microsoft.AspNetCore.Mvc; using JCSoft.WX.Framework.Models.ApiRequests; using JCSoft.WX.Framework.Models.ApiResponses; using Microsoft.Extensions.Caching.Memory; namespace SupplierWeb.Controllers { public abstract class BaseApiController : BaseController where T : ApiResponse, new() { public BaseApiController(IMemoryCache cache, IApiClient client) : base(cache, client) { } public JsonResult Get() { var request = GetApiRequest(); var response = _client.Execute(request); return Json(response); } protected abstract ApiRequest GetApiRequest(); } }