diff --git a/Application/Common/Interface/IRepositoryService.cs b/Application/Common/Interface/IRepositoryService.cs new file mode 100644 index 0000000..5abfdfc --- /dev/null +++ b/Application/Common/Interface/IRepositoryService.cs @@ -0,0 +1,18 @@ +using Application.Common.Model; +using Application.Master.Dto; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Application.Common.Interface +{ + public interface IRepositoryService where T : class + { + Task GetAsync(); + Task GetByIdAsync(int Id); + Task UpsertAsync(T modelToUpdate); + Task DeleteAsync(int Id); + } +} diff --git a/Application/Master/AppSettingService.cs b/Application/Master/AppSettingService.cs index 967a18b..40dfb4f 100644 --- a/Application/Master/AppSettingService.cs +++ b/Application/Master/AppSettingService.cs @@ -72,8 +72,9 @@ public async Task DeleteAsync(int Id) } #endregion - #region Queries - public async Task GetAppSettingsAsync() + #region Queries + + public async Task GetAsync() { try { @@ -86,13 +87,13 @@ public async Task GetAppSettingsAsync() } catch (Exception ex) { - Log(nameof(GetAppSettingsAsync), ex.Message); + Log(nameof(GetAsync), ex.Message); logger?.LogError(ex.ToString()); return ResponseModel.FailureResponse(GlobalDeclaration._internalServerError); - } - - } - public async Task GetAppSettingByIdAsync(int Id) + } + } + + public async Task GetByIdAsync(int Id) { try { @@ -107,12 +108,11 @@ public async Task GetAppSettingByIdAsync(int Id) } catch (Exception ex) { - Log(nameof(DeleteAsync), ex.Message); + Log(nameof(GetByIdAsync), ex.Message); logger?.LogError(ex.ToString()); return ResponseModel.FailureResponse(GlobalDeclaration._internalServerError); - } + } } - #endregion #endregion @@ -121,7 +121,8 @@ public async Task GetAppSettingByIdAsync(int Id) private void Log(string method, string msg) { errorMessageLog.LogError("Application", "AppSettingService", method, msg); - } + } + #endregion } } diff --git a/Application/Master/IAppSettingService.cs b/Application/Master/IAppSettingService.cs index d663305..29f4825 100644 --- a/Application/Master/IAppSettingService.cs +++ b/Application/Master/IAppSettingService.cs @@ -1,14 +1,11 @@ -using Application.Common.Model; +using Application.Common.Interface; +using Application.Common.Model; using Application.Master.Dto; using Domain.Master; namespace Application.Master { - public interface IAppSettingService + public interface IAppSettingService : IRepositoryService { - Task GetAppSettingsAsync(); - Task GetAppSettingByIdAsync(int Id); - Task UpsertAsync(AppSettingVm appSetting); - Task DeleteAsync(int Id); } } diff --git a/WebApp/Pages/Master/AppSetting.razor b/WebApp/Pages/Master/AppSetting.razor index cebb374..6a19506 100644 --- a/WebApp/Pages/Master/AppSetting.razor +++ b/WebApp/Pages/Master/AppSetting.razor @@ -126,7 +126,7 @@ else { try { - var response = await appSettingService.GetAppSettingsAsync(); + var response = await appSettingService.GetAsync(); if (response.Success) appSettingVmList = response.Output; else