.NET MVC REST API Calling 2nd API w/Repository Pattern Issues

So, I am trying to create an API that can call another API and store some data in a SQL DB, i.e:

CLIENT -> HTTPGET/POST -> API -> CALLS 2ND API -> STORES DATA IN SQL

I have achieved this with a console app:

using System.Net;
using System.Net.Http.Headers;
using System.Text.Json;
using WebApiClient.Data;
using HttpClient client = new();
  
client.DefaultRequestHeaders.Accept.Clear();



var breweries = await ProcessBreweriesApiAsync(client);
foreach (var brew in breweries)
{
    Console.WriteLine($"id: {brew.Id}");
    Console.WriteLine($"name: {brew.Name}");
    Console.WriteLine($"brewery_type: {brew.BreweryType}");
    // Console.WriteLine($"address_1: {brew.Address1}");
    // Console.WriteLine($"address_2: {brew.Address2}");
    // Console.WriteLine($"address_3: {brew.Address3}");
    // Console.WriteLine($"city: {brew.City}");
    // Console.WriteLine($"state_province: {brew.StateProvince}");
    // Console.WriteLine($"postal_code: {brew.PostalCode}");
    // Console.WriteLine($"longitude: {brew.Longitude}");
    // Console.WriteLine($"latitude: {brew.Latitude}");
    // Console.WriteLine($"phone: {brew.Phone}");
    // Console.WriteLine($"state: {brew.State}");
    // Console.WriteLine($"street: {brew.Street}");
    Console.WriteLine("Saving data into SQL");
    
    var db = new AppDbContext();
    db.Breweries?.AddRange(breweries);
    db.SaveChanges();

    Console.WriteLine("Finished Saving");
    
    
    Console.WriteLine();
}


static async Task<List<BreweryModel>> ProcessBreweriesApiAsync(HttpClient client)
{
    await using Stream stream =
        await client.GetStreamAsync("https://api.openbrewerydb.org/breweries");
    var breweries =
        await JsonSerializer.DeserializeAsync<List<BreweryModel>>(stream);
    return breweries ?? new();
}

However, I’m now trying to implement the same with an MVC API, using a couple of concepts I’d learnt in previous tutorials, such as repository pattern to get accustomed with the concepts, I cannot seem to figure out how to get this built.

I have created a method sig in the interface, then an async implementation of the method, however, this errors that I haven’t implemented the interface, but when I change the interface to ASYNC I am receiving:

The ‘async’ modifier can only be used in methods that have a body.CS1994

**Controller **

[ApiController]
[Route("api/[controller]")]
public class BreweryController : ControllerBase
{
    private readonly IBreweryRepo _repository;
    public BreweryController(
        IBreweryRepo repository
    )
    {
        _repository = repository;
    }



    [HttpGet(Name = "UpdateBreweries")]
      public ActionResult<IEnumerable<BreweryModel>> UpdateBreweries ()
        {
            Console.WriteLine("Updating Breweries Now...");
            var breweries = _repository.ImportBreweries();
            _repository.SaveChanges();
            return Ok (breweries);
        
        }

}

Interface

using XXX.Models;
namespace XXX.Data
{
    public interface IBreweryRepo
    {
        Task ImportBreweries ();
         bool SaveChanges();


    }
}

Implementation

namespace XXX.Data
{
public class BreweryRepo : IBreweryRepo
{
//DI
private readonly AppDbContext _context;
public BreweryRepo(AppDbContext context)
{
_context = context;
}

    //public async IActionResult UpdateBreweries <BreweryModel<List>> (HttpClient client)
    public async Task UpdateBreweries()
    {
        HttpClient client = new HttpClient();
        await using Stream stream =
        await client.GetStreamAsync("https://api.openbrewerydb.org/breweries");
        var breweries =
        await JsonSerializer.DeserializeAsync<List<BreweryModel>>(stream);
        _context.Breweries.AddRange(breweries);
        
    }
    public bool SaveChanges()
    {
        return (_context.SaveChanges() >= 0);
    }

}

}

Cannot seem to get it to load async.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật