public IActionResult GetYears() { try { ObjectResult results = new ObjectResult(_yearRepository.GetAll()) { StatusCode = (int)HttpStatusCode.OK }; Request.HttpContext.Response.Headers.Add("X-Total-Count", _yearRepository.GetAll().Count().ToString()); return(results); } catch (Exception ex) { return(new StatusCodeResult(500)); } }
public List <Year> GetAll() { return(_repository.GetAll()); }