添加项目文件。

This commit is contained in:
SpecialX
2025-05-23 19:03:00 +08:00
parent 6fa7679fd3
commit d36fef2bbb
185 changed files with 13413 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
using Entities.DTO;
using System.Net;
using System.Net.Http.Json;
using System.Text.Json;
namespace TechHelper.Client.Services
{
public class ClasssServices : IClassServices
{
private HttpClient _client;
private IHttpClientFactory _httpClientFactory;
public ClasssServices(HttpClient client, IHttpClientFactory httpClientFactory)
{
_client = client;
_httpClientFactory = httpClientFactory;
}
public Task<ResponseDto> CreateClass(UserRegistrationToClassDto userClass)
{
throw new NotImplementedException();
}
public async Task<ResponseDto> UserRegister(UserRegistrationToClassDto userRegistrationToClassDto)
{
using (_client = _httpClientFactory.CreateClient("Default"))
{
try
{
var result = await _client.PostAsJsonAsync("class/userRegiste",
userRegistrationToClassDto);
var data = await result.Content.ReadAsStringAsync();
return new ResponseDto { IsSuccessfulRegistration = result.IsSuccessStatusCode, Errors = new string[] { data } };
}
catch (Exception ex)
{
return new ResponseDto { IsSuccessfulRegistration = false, Errors = new string[] { ex.Message } };
}
}
}
}
}

View File

@@ -0,0 +1,12 @@
using Entities.DTO;
using System.Net;
using TechHelper.Services;
namespace TechHelper.Client.Services
{
public interface IClassServices
{
public Task<ResponseDto> UserRegister(UserRegistrationToClassDto userRegistrationToClassDto);
public Task<ResponseDto> CreateClass(UserRegistrationToClassDto userClass);
}
}