|
@@ -73,7 +73,7 @@ namespace Esim.Apis.Business
|
|
|
})
|
|
})
|
|
|
.ToList();
|
|
.ToList();
|
|
|
|
|
|
|
|
- return ApiResponseHelper.BuildResponse(
|
|
|
|
|
|
|
+ return DotnetLib.Http.HttpResponse.BuildResponse(
|
|
|
log, url, json,
|
|
log, url, json,
|
|
|
CommonErrorCode.Success,
|
|
CommonErrorCode.Success,
|
|
|
ConfigManager.Instance.GetConfigWebValue("LOAD_SUCCESS", lang),
|
|
ConfigManager.Instance.GetConfigWebValue("LOAD_SUCCESS", lang),
|
|
@@ -84,7 +84,7 @@ namespace Esim.Apis.Business
|
|
|
{
|
|
{
|
|
|
log.Error("Exception: ", ex);
|
|
log.Error("Exception: ", ex);
|
|
|
}
|
|
}
|
|
|
- return ApiResponseHelper.BuildResponse(
|
|
|
|
|
|
|
+ return DotnetLib.Http.HttpResponse.BuildResponse(
|
|
|
log, url, json,
|
|
log, url, json,
|
|
|
CommonErrorCode.SystemError,
|
|
CommonErrorCode.SystemError,
|
|
|
ConfigManager.Instance.GetConfigWebValue("SYSTEM_FAILURE"),
|
|
ConfigManager.Instance.GetConfigWebValue("SYSTEM_FAILURE"),
|
|
@@ -136,7 +136,7 @@ namespace Esim.Apis.Business
|
|
|
})
|
|
})
|
|
|
.ToList();
|
|
.ToList();
|
|
|
|
|
|
|
|
- return ApiResponseHelper.BuildResponse(
|
|
|
|
|
|
|
+ return DotnetLib.Http.HttpResponse.BuildResponse(
|
|
|
log, url, json,
|
|
log, url, json,
|
|
|
CommonErrorCode.Success,
|
|
CommonErrorCode.Success,
|
|
|
ConfigManager.Instance.GetConfigWebValue("LOAD_SUCCESS", lang),
|
|
ConfigManager.Instance.GetConfigWebValue("LOAD_SUCCESS", lang),
|
|
@@ -147,7 +147,7 @@ namespace Esim.Apis.Business
|
|
|
{
|
|
{
|
|
|
log.Error("Exception: ", ex);
|
|
log.Error("Exception: ", ex);
|
|
|
}
|
|
}
|
|
|
- return ApiResponseHelper.BuildResponse(
|
|
|
|
|
|
|
+ return DotnetLib.Http.HttpResponse.BuildResponse(
|
|
|
log, url, json,
|
|
log, url, json,
|
|
|
CommonErrorCode.SystemError,
|
|
CommonErrorCode.SystemError,
|
|
|
ConfigManager.Instance.GetConfigWebValue("SYSTEM_FAILURE"),
|
|
ConfigManager.Instance.GetConfigWebValue("SYSTEM_FAILURE"),
|
|
@@ -167,7 +167,7 @@ namespace Esim.Apis.Business
|
|
|
// Validate required fields
|
|
// Validate required fields
|
|
|
if (string.IsNullOrEmpty(request.customerName) || string.IsNullOrEmpty(request.reviewContent))
|
|
if (string.IsNullOrEmpty(request.customerName) || string.IsNullOrEmpty(request.reviewContent))
|
|
|
{
|
|
{
|
|
|
- return ApiResponseHelper.BuildResponse(
|
|
|
|
|
|
|
+ return DotnetLib.Http.HttpResponse.BuildResponse(
|
|
|
log, url, json,
|
|
log, url, json,
|
|
|
CommonErrorCode.RequiredFieldMissing,
|
|
CommonErrorCode.RequiredFieldMissing,
|
|
|
ConfigManager.Instance.GetConfigWebValue("REQUIRED_FIELD_MISSING", lang),
|
|
ConfigManager.Instance.GetConfigWebValue("REQUIRED_FIELD_MISSING", lang),
|
|
@@ -190,7 +190,7 @@ namespace Esim.Apis.Business
|
|
|
dbContext.CustomerReviews.Add(review);
|
|
dbContext.CustomerReviews.Add(review);
|
|
|
await dbContext.SaveChangesAsync();
|
|
await dbContext.SaveChangesAsync();
|
|
|
|
|
|
|
|
- return ApiResponseHelper.BuildResponse(
|
|
|
|
|
|
|
+ return DotnetLib.Http.HttpResponse.BuildResponse(
|
|
|
log, url, json,
|
|
log, url, json,
|
|
|
CommonErrorCode.Success,
|
|
CommonErrorCode.Success,
|
|
|
ConfigManager.Instance.GetConfigWebValue("REVIEW_SUBMITTED", lang),
|
|
ConfigManager.Instance.GetConfigWebValue("REVIEW_SUBMITTED", lang),
|
|
@@ -201,7 +201,7 @@ namespace Esim.Apis.Business
|
|
|
{
|
|
{
|
|
|
log.Error("Exception: ", ex);
|
|
log.Error("Exception: ", ex);
|
|
|
}
|
|
}
|
|
|
- return ApiResponseHelper.BuildResponse(
|
|
|
|
|
|
|
+ return DotnetLib.Http.HttpResponse.BuildResponse(
|
|
|
log, url, json,
|
|
log, url, json,
|
|
|
CommonErrorCode.SystemError,
|
|
CommonErrorCode.SystemError,
|
|
|
ConfigManager.Instance.GetConfigWebValue("SYSTEM_FAILURE"),
|
|
ConfigManager.Instance.GetConfigWebValue("SYSTEM_FAILURE"),
|
|
@@ -246,7 +246,7 @@ namespace Esim.Apis.Business
|
|
|
})
|
|
})
|
|
|
.ToList();
|
|
.ToList();
|
|
|
|
|
|
|
|
- return ApiResponseHelper.BuildResponse(
|
|
|
|
|
|
|
+ return DotnetLib.Http.HttpResponse.BuildResponse(
|
|
|
log, url, json,
|
|
log, url, json,
|
|
|
CommonErrorCode.Success,
|
|
CommonErrorCode.Success,
|
|
|
ConfigManager.Instance.GetConfigWebValue("LOAD_SUCCESS", lang),
|
|
ConfigManager.Instance.GetConfigWebValue("LOAD_SUCCESS", lang),
|
|
@@ -257,7 +257,7 @@ namespace Esim.Apis.Business
|
|
|
{
|
|
{
|
|
|
log.Error("Exception: ", ex);
|
|
log.Error("Exception: ", ex);
|
|
|
}
|
|
}
|
|
|
- return ApiResponseHelper.BuildResponse(
|
|
|
|
|
|
|
+ return DotnetLib.Http.HttpResponse.BuildResponse(
|
|
|
log, url, json,
|
|
log, url, json,
|
|
|
CommonErrorCode.SystemError,
|
|
CommonErrorCode.SystemError,
|
|
|
ConfigManager.Instance.GetConfigWebValue("SYSTEM_FAILURE"),
|
|
ConfigManager.Instance.GetConfigWebValue("SYSTEM_FAILURE"),
|
|
@@ -312,7 +312,7 @@ namespace Esim.Apis.Business
|
|
|
})
|
|
})
|
|
|
.ToList();
|
|
.ToList();
|
|
|
|
|
|
|
|
- return ApiResponseHelper.BuildResponse(
|
|
|
|
|
|
|
+ return DotnetLib.Http.HttpResponse.BuildResponse(
|
|
|
log, url, json,
|
|
log, url, json,
|
|
|
CommonErrorCode.Success,
|
|
CommonErrorCode.Success,
|
|
|
ConfigManager.Instance.GetConfigWebValue("LOAD_SUCCESS", lang),
|
|
ConfigManager.Instance.GetConfigWebValue("LOAD_SUCCESS", lang),
|
|
@@ -323,7 +323,7 @@ namespace Esim.Apis.Business
|
|
|
{
|
|
{
|
|
|
log.Error("Exception: ", ex);
|
|
log.Error("Exception: ", ex);
|
|
|
}
|
|
}
|
|
|
- return ApiResponseHelper.BuildResponse(
|
|
|
|
|
|
|
+ return DotnetLib.Http.HttpResponse.BuildResponse(
|
|
|
log, url, json,
|
|
log, url, json,
|
|
|
CommonErrorCode.SystemError,
|
|
CommonErrorCode.SystemError,
|
|
|
ConfigManager.Instance.GetConfigWebValue("SYSTEM_FAILURE"),
|
|
ConfigManager.Instance.GetConfigWebValue("SYSTEM_FAILURE"),
|
|
@@ -406,7 +406,7 @@ namespace Esim.Apis.Business
|
|
|
})
|
|
})
|
|
|
.ToList();
|
|
.ToList();
|
|
|
|
|
|
|
|
- return ApiResponseHelper.BuildResponse(
|
|
|
|
|
|
|
+ return DotnetLib.Http.HttpResponse.BuildResponse(
|
|
|
log, url, json,
|
|
log, url, json,
|
|
|
CommonErrorCode.Success,
|
|
CommonErrorCode.Success,
|
|
|
ConfigManager.Instance.GetConfigWebValue("LOAD_SUCCESS", lang),
|
|
ConfigManager.Instance.GetConfigWebValue("LOAD_SUCCESS", lang),
|
|
@@ -427,7 +427,7 @@ namespace Esim.Apis.Business
|
|
|
{
|
|
{
|
|
|
log.Error("Exception: ", exception);
|
|
log.Error("Exception: ", exception);
|
|
|
}
|
|
}
|
|
|
- return ApiResponseHelper.BuildResponse(
|
|
|
|
|
|
|
+ return DotnetLib.Http.HttpResponse.BuildResponse(
|
|
|
log, url, json,
|
|
log, url, json,
|
|
|
CommonErrorCode.SystemError,
|
|
CommonErrorCode.SystemError,
|
|
|
ConfigManager.Instance.GetConfigWebValue("SYSTEM_FAILURE"),
|
|
ConfigManager.Instance.GetConfigWebValue("SYSTEM_FAILURE"),
|
|
@@ -444,22 +444,43 @@ namespace Esim.Apis.Business
|
|
|
log.Debug("URL: " + url);
|
|
log.Debug("URL: " + url);
|
|
|
try
|
|
try
|
|
|
{
|
|
{
|
|
|
- // Get distinct brands with device count
|
|
|
|
|
- var brands = dbContext.DeviceEsimCompatibilities
|
|
|
|
|
|
|
+ // Get language from header
|
|
|
|
|
+ string lang = CommonLogic.GetLanguage(httpRequest);
|
|
|
|
|
+
|
|
|
|
|
+ // Get all active devices for client-side filtering
|
|
|
|
|
+ var allDevices = dbContext.DeviceEsimCompatibilities
|
|
|
.Where(d => d.Status == true && d.SupportsEsim == true)
|
|
.Where(d => d.Status == true && d.SupportsEsim == true)
|
|
|
|
|
+ .OrderBy(d => d.DisplayOrder)
|
|
|
|
|
+ .ThenBy(d => d.ModelName)
|
|
|
|
|
+ .ToList();
|
|
|
|
|
+
|
|
|
|
|
+ // Group devices by brand and include full device list
|
|
|
|
|
+ var brands = allDevices
|
|
|
.GroupBy(d => d.Brand)
|
|
.GroupBy(d => d.Brand)
|
|
|
.Select(g => new
|
|
.Select(g => new
|
|
|
{
|
|
{
|
|
|
brand = g.Key,
|
|
brand = g.Key,
|
|
|
deviceCount = g.Count(),
|
|
deviceCount = g.Count(),
|
|
|
- popularCount = g.Count(d => d.IsPopular == true)
|
|
|
|
|
|
|
+ popularCount = g.Count(d => d.IsPopular == true),
|
|
|
|
|
+ devices = g.Select(d => new
|
|
|
|
|
+ {
|
|
|
|
|
+ d.Id,
|
|
|
|
|
+ modelName = lang == "en"
|
|
|
|
|
+ ? (d.ModelNameEn ?? d.ModelName)
|
|
|
|
|
+ : (d.ModelNameLo ?? d.ModelName),
|
|
|
|
|
+ d.Category,
|
|
|
|
|
+ d.IsPopular,
|
|
|
|
|
+ d.DisplayOrder,
|
|
|
|
|
+ notes = lang == "en"
|
|
|
|
|
+ ? (d.NotesEn ?? d.Notes)
|
|
|
|
|
+ : (d.NotesLo ?? d.Notes)
|
|
|
|
|
+ }).ToList()
|
|
|
})
|
|
})
|
|
|
.OrderBy(b => b.brand)
|
|
.OrderBy(b => b.brand)
|
|
|
.ToList();
|
|
.ToList();
|
|
|
|
|
|
|
|
// Get distinct categories with device count
|
|
// Get distinct categories with device count
|
|
|
- var categories = dbContext.DeviceEsimCompatibilities
|
|
|
|
|
- .Where(d => d.Status == true && d.SupportsEsim == true)
|
|
|
|
|
|
|
+ var categories = allDevices
|
|
|
.GroupBy(d => d.Category)
|
|
.GroupBy(d => d.Category)
|
|
|
.Select(g => new
|
|
.Select(g => new
|
|
|
{
|
|
{
|
|
@@ -469,10 +490,10 @@ namespace Esim.Apis.Business
|
|
|
.OrderBy(c => c.category)
|
|
.OrderBy(c => c.category)
|
|
|
.ToList();
|
|
.ToList();
|
|
|
|
|
|
|
|
- return ApiResponseHelper.BuildResponse(
|
|
|
|
|
|
|
+ return DotnetLib.Http.HttpResponse.BuildResponse(
|
|
|
log, url, "",
|
|
log, url, "",
|
|
|
CommonErrorCode.Success,
|
|
CommonErrorCode.Success,
|
|
|
- ConfigManager.Instance.GetConfigWebValue("LOAD_SUCCESS"),
|
|
|
|
|
|
|
+ ConfigManager.Instance.GetConfigWebValue("LOAD_SUCCESS", lang),
|
|
|
new
|
|
new
|
|
|
{
|
|
{
|
|
|
brands = brands,
|
|
brands = brands,
|
|
@@ -484,7 +505,7 @@ namespace Esim.Apis.Business
|
|
|
{
|
|
{
|
|
|
log.Error("Exception: ", exception);
|
|
log.Error("Exception: ", exception);
|
|
|
}
|
|
}
|
|
|
- return ApiResponseHelper.BuildResponse(
|
|
|
|
|
|
|
+ return DotnetLib.Http.HttpResponse.BuildResponse(
|
|
|
log, url, "",
|
|
log, url, "",
|
|
|
CommonErrorCode.SystemError,
|
|
CommonErrorCode.SystemError,
|
|
|
ConfigManager.Instance.GetConfigWebValue("SYSTEM_FAILURE"),
|
|
ConfigManager.Instance.GetConfigWebValue("SYSTEM_FAILURE"),
|