using Entities.Contracts; using Entities.DTO; using System.Net.Http.Json; using TechHelper.Client.HttpRepository; namespace TechHelper.Client.Services { public class CommonService : ICommonService { private readonly HttpClient _client; private readonly IAuthenticationClientService _authenticationClientService; public CommonService(HttpClient client, IAuthenticationClientService authenticationClientService) { _client = client; _authenticationClientService = authenticationClientService; } public async Task> GetCommonTypesAsync(TypeNameType typeNameType, Guid? SubjectId = null) { switch (typeNameType) { case TypeNameType.Subject: { var response = await _client.GetAsync("subject"); var result = await response.Content.ReadFromJsonAsync>(); return result; } case TypeNameType.ExamType: { var response = await _client.GetAsync("exam-type"); var result = await response.Content.ReadFromJsonAsync>(); return result; } case TypeNameType.QuestionType: { var response = await _client.GetAsync("question-type"); var result = await response.Content.ReadFromJsonAsync>(); return result; } } throw new NotImplementedException(); } } }