using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; namespace PartSource.Api.Controllers { public class BaseApiController : ControllerBase { public ActionResult ApiResponse(T response) { switch (response) { case IList list: if (list.Count == 0) { return NoContent(); } break; default: if (response == null) { return NotFound(); } break; } return Ok(response); } } }