© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•2y ago•
5 replies
Anubhav

Guys in my service class my interface is throwing some error can you help:

namespace AI_APP_API_BAL.Services
{
    public class StudentService : IStudentService
    {
        private readonly DBContext _context;
        private readonly HttpClient _httpClient;
        private readonly AuthorizationSettings _AuthorizationSettings;

        public StudentService(DBContext context, HttpClient httpClient)
        {
            _context = context;
            _httpClient = httpClient;
            _AuthorizationSettings = new AuthorizationSettings();
        }

        public async Task CallThirdPartyApiAsync(string phoneNumber)
        {
            var request = new HttpRequestMessage(HttpMethod.Post, "https://api.bland.ai/v1/calls");
            request.Headers.Add("Authorization", _AuthorizationSettings.ApiKey);

            var content = new StringContent("{\r\n  \"phone_number\": \"+919557611780\",\r\n  \"task\": \"Say Hello Anubhav How are you\",\r\n  \"voice\" : \"maya\"\r\n}", null, "application/json");
            request.Content = content;

            var response = await _httpClient.SendAsync(request);
            response.EnsureSuccessStatusCode();

            var responseContent = await response.Content.ReadAsStringAsync();

            // Deserialize the response content into a CallerId object
            var callerId = JsonConvert.DeserializeObject<CallerId>(responseContent);

            // Save the CallerId object to the database
            _context.callerid.Add(callerId);
            await _context.SaveChangesAsync();
        }
    }
namespace AI_APP_API_BAL.Services
{
    public class StudentService : IStudentService
    {
        private readonly DBContext _context;
        private readonly HttpClient _httpClient;
        private readonly AuthorizationSettings _AuthorizationSettings;

        public StudentService(DBContext context, HttpClient httpClient)
        {
            _context = context;
            _httpClient = httpClient;
            _AuthorizationSettings = new AuthorizationSettings();
        }

        public async Task CallThirdPartyApiAsync(string phoneNumber)
        {
            var request = new HttpRequestMessage(HttpMethod.Post, "https://api.bland.ai/v1/calls");
            request.Headers.Add("Authorization", _AuthorizationSettings.ApiKey);

            var content = new StringContent("{\r\n  \"phone_number\": \"+919557611780\",\r\n  \"task\": \"Say Hello Anubhav How are you\",\r\n  \"voice\" : \"maya\"\r\n}", null, "application/json");
            request.Content = content;

            var response = await _httpClient.SendAsync(request);
            response.EnsureSuccessStatusCode();

            var responseContent = await response.Content.ReadAsStringAsync();

            // Deserialize the response content into a CallerId object
            var callerId = JsonConvert.DeserializeObject<CallerId>(responseContent);

            // Save the CallerId object to the database
            _context.callerid.Add(callerId);
            await _context.SaveChangesAsync();
        }
    }


Error :: Severity Code Description Project File Line Suppression State
Error (active) CS0535 'StudentService' does not implement interface member 'IStudentService.CallDataApiAsync(callDataModel)' AI_APP_API_BAL C:\Users\91955\OneDrive\Desktop\AI_APP_API\AI_APP_API_BAL\Services\StudentService.cs 12
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Should you make an interface for a specific Service Class which is more niche.
C#CC# / help
15mo ago
Hey guys this is my service file :
C#CC# / help
2y ago
✅ How can I call methods on the class the is implementing my interface
C#CC# / help
8mo ago
✅ Abstract Class vs Interface
C#CC# / help
10mo ago