重构项目结构,移除Assignment相关功能,优化Submission模块
Some checks failed
TechAct / explore-gitea-actions (push) Failing after 12s
Some checks failed
TechAct / explore-gitea-actions (push) Failing after 12s
This commit is contained in:
47
TechHelper.Client/Services/CommonService.cs
Normal file
47
TechHelper.Client/Services/CommonService.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
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<List<TypeCommonDto>> GetCommonTypesAsync(TypeNameType typeNameType, Guid? SubjectId = null)
|
||||
{
|
||||
|
||||
switch (typeNameType)
|
||||
{
|
||||
case TypeNameType.Subject:
|
||||
{
|
||||
var response = await _client.GetAsync("subject");
|
||||
var result = await response.Content.ReadFromJsonAsync<List<TypeCommonDto>>();
|
||||
return result;
|
||||
}
|
||||
case TypeNameType.ExamType:
|
||||
{
|
||||
var response = await _client.GetAsync("exam-type");
|
||||
var result = await response.Content.ReadFromJsonAsync<List<TypeCommonDto>>();
|
||||
return result;
|
||||
}
|
||||
case TypeNameType.QuestionType:
|
||||
{
|
||||
var response = await _client.GetAsync("question-type");
|
||||
var result = await response.Content.ReadFromJsonAsync<List<TypeCommonDto>>();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user