initial commit

This commit is contained in:
2026-07-21 14:35:37 +07:00
commit 0027997ff9
798 changed files with 59083 additions and 0 deletions
@@ -0,0 +1,66 @@
using Indotalent.ConfigBackEnd.Interfaces;
using Indotalent.ConfigFrontEnd.Common;
using Indotalent.Features.Organization.Employee.Cqrs;
using Indotalent.Infrastructure.Authentication.Identity;
using Indotalent.Shared.Models;
using Microsoft.AspNetCore.Components;
using MudBlazor;
using RestSharp;
namespace Indotalent.Features.Organization.Employee;
public class EmployeeService : BaseService
{
private readonly RestClient _client;
public EmployeeService(
IHttpClientFactory clientFactory,
NavigationManager nav,
ISnackbar snackbar,
ICurrentUserService currentUserService,
TokenProvider tokenProvider)
: base(clientFactory, nav, snackbar, currentUserService, tokenProvider)
{
_client = new RestClient(nav.BaseUri);
}
public async Task<ApiResponse<List<GetEmployeeListResponse>>?> GetEmployeeListAsync()
{
var request = new RestRequest("api/employee", Method.Get);
return await ExecuteWithResponseAsync<List<GetEmployeeListResponse>>(_client, request);
}
public async Task<ApiResponse<GetEmployeeByIdResponse>?> GetEmployeeByIdAsync(string id)
{
var request = new RestRequest($"api/employee/{id}", Method.Get);
return await ExecuteWithResponseAsync<GetEmployeeByIdResponse>(_client, request);
}
public async Task<ApiResponse<LookupEmployeeResponse>?> GetEmployeeLookupAsync()
{
var request = new RestRequest("api/employee/lookup", Method.Get);
return await ExecuteWithResponseAsync<LookupEmployeeResponse>(_client, request);
}
public async Task<ApiResponse<CreateEmployeeResponse>?> CreateEmployeeAsync(CreateEmployeeRequest data)
{
var request = new RestRequest("api/employee", Method.Post);
request.AddJsonBody(data);
return await ExecuteWithResponseAsync<CreateEmployeeResponse>(_client, request);
}
public async Task<bool> DeleteEmployeeByIdAsync(string id)
{
var request = new RestRequest($"api/employee/delete/{id}", Method.Post);
var response = await ExecuteWithResponseAsync<object>(_client, request);
return response?.IsSuccess ?? false;
}
public async Task<ApiResponse<UpdateEmployeeResponse>?> UpdateEmployeeAsync(UpdateEmployeeRequest data)
{
var request = new RestRequest("api/employee/update", Method.Post);
request.AddJsonBody(data);
return await ExecuteWithResponseAsync<UpdateEmployeeResponse>(_client, request);
}
}