public async Task <ActionResult> GetBills(int id) { try { if (await _repo.GetBillById(id) is CoreBills bill) { var transformed = ApiMapper.MapBills(bill); return(Ok(transformed)); } } catch (NullReferenceException) { return(NotFound($"No bill with the id of {id}.")); } return(Ok("There are no bills.")); }