|
@@ -38,7 +38,7 @@ namespace Esim.Apis.Business
|
|
|
int pageSize = request.pageSize <= 0 ? 10 : request.pageSize;
|
|
int pageSize = request.pageSize <= 0 ? 10 : request.pageSize;
|
|
|
|
|
|
|
|
var query = dbContext.Banners
|
|
var query = dbContext.Banners
|
|
|
- .Where(b => b.Status == true)
|
|
|
|
|
|
|
+ .Where(b => b.Status.HasValue && b.Status.Value)
|
|
|
.Where(b => b.StartDate == null || b.StartDate <= DateTime.Now)
|
|
.Where(b => b.StartDate == null || b.StartDate <= DateTime.Now)
|
|
|
.Where(b => b.EndDate == null || b.EndDate >= DateTime.Now);
|
|
.Where(b => b.EndDate == null || b.EndDate >= DateTime.Now);
|
|
|
|
|
|
|
@@ -58,12 +58,12 @@ namespace Esim.Apis.Business
|
|
|
.Select(b => new
|
|
.Select(b => new
|
|
|
{
|
|
{
|
|
|
b.Id,
|
|
b.Id,
|
|
|
- title = lang == "en"
|
|
|
|
|
- ? (b.TitleEn ?? b.Title)
|
|
|
|
|
- : (b.TitleLo ?? b.Title),
|
|
|
|
|
- subtitle = lang == "en"
|
|
|
|
|
- ? (b.SubtitleEn ?? b.Subtitle)
|
|
|
|
|
- : (b.SubtitleLo ?? b.Subtitle),
|
|
|
|
|
|
|
+ title = lang == "en" ? (b.TitleEn ?? b.Title)
|
|
|
|
|
+ : lang == "vi" ? b.Title
|
|
|
|
|
+ : (b.TitleLo ?? b.Title),
|
|
|
|
|
+ subtitle = lang == "en" ? (b.SubtitleEn ?? b.Subtitle)
|
|
|
|
|
+ : lang == "vi" ? b.Subtitle
|
|
|
|
|
+ : (b.SubtitleLo ?? b.Subtitle),
|
|
|
b.ImageUrl,
|
|
b.ImageUrl,
|
|
|
b.ImageMobileUrl,
|
|
b.ImageMobileUrl,
|
|
|
b.LinkUrl,
|
|
b.LinkUrl,
|
|
@@ -104,11 +104,11 @@ namespace Esim.Apis.Business
|
|
|
int pageSize = request.pageSize <= 0 ? 10 : request.pageSize;
|
|
int pageSize = request.pageSize <= 0 ? 10 : request.pageSize;
|
|
|
|
|
|
|
|
var query = dbContext.CustomerReviews
|
|
var query = dbContext.CustomerReviews
|
|
|
- .Where(r => r.Status == true);
|
|
|
|
|
|
|
+ .Where(r => r.Status.HasValue && r.Status.Value);
|
|
|
|
|
|
|
|
if (request.isFeatured.HasValue && request.isFeatured.Value)
|
|
if (request.isFeatured.HasValue && request.isFeatured.Value)
|
|
|
{
|
|
{
|
|
|
- query = query.Where(r => r.IsFeatured == true);
|
|
|
|
|
|
|
+ query = query.Where(r => r.IsFeatured.HasValue && r.IsFeatured.Value);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
int totalCount = query.Count();
|
|
int totalCount = query.Count();
|
|
@@ -125,12 +125,12 @@ namespace Esim.Apis.Business
|
|
|
r.CustomerName,
|
|
r.CustomerName,
|
|
|
r.AvatarUrl,
|
|
r.AvatarUrl,
|
|
|
r.Rating,
|
|
r.Rating,
|
|
|
- reviewContent = lang == "en"
|
|
|
|
|
- ? (r.ReviewContentEn ?? r.ReviewContent)
|
|
|
|
|
- : (r.ReviewContentLo ?? r.ReviewContent),
|
|
|
|
|
- destination = lang == "en"
|
|
|
|
|
- ? (r.DestinationEn ?? r.Destination)
|
|
|
|
|
- : (r.DestinationLo ?? r.Destination),
|
|
|
|
|
|
|
+ reviewContent = lang == "en" ? (r.ReviewContentEn ?? r.ReviewContent)
|
|
|
|
|
+ : lang == "vi" ? r.ReviewContent
|
|
|
|
|
+ : (r.ReviewContentLo ?? r.ReviewContent),
|
|
|
|
|
+ destination = lang == "en" ? (r.DestinationEn ?? r.Destination)
|
|
|
|
|
+ : lang == "vi" ? r.Destination
|
|
|
|
|
+ : (r.DestinationLo ?? r.Destination),
|
|
|
r.IsFeatured,
|
|
r.IsFeatured,
|
|
|
r.CreatedDate
|
|
r.CreatedDate
|
|
|
})
|
|
})
|
|
@@ -210,7 +210,7 @@ namespace Esim.Apis.Business
|
|
|
int pageSize = request.pageSize <= 0 ? 10 : request.pageSize;
|
|
int pageSize = request.pageSize <= 0 ? 10 : request.pageSize;
|
|
|
|
|
|
|
|
var query = dbContext.FaqCategories
|
|
var query = dbContext.FaqCategories
|
|
|
- .Where(c => c.Status == true);
|
|
|
|
|
|
|
+ .Where(c => c.Status.HasValue && c.Status.Value);
|
|
|
|
|
|
|
|
int totalCount = query.Count();
|
|
int totalCount = query.Count();
|
|
|
int totalPages = (int)Math.Ceiling((double)totalCount / pageSize);
|
|
int totalPages = (int)Math.Ceiling((double)totalCount / pageSize);
|
|
@@ -223,13 +223,13 @@ namespace Esim.Apis.Business
|
|
|
.Select(c => new
|
|
.Select(c => new
|
|
|
{
|
|
{
|
|
|
c.Id,
|
|
c.Id,
|
|
|
- categoryName = lang == "en"
|
|
|
|
|
- ? (c.CategoryNameEn ?? c.CategoryName)
|
|
|
|
|
- : (c.CategoryNameLo ?? c.CategoryName),
|
|
|
|
|
|
|
+ categoryName = lang == "en" ? (c.CategoryNameEn ?? c.CategoryName)
|
|
|
|
|
+ : lang == "vi" ? c.CategoryName
|
|
|
|
|
+ : (c.CategoryNameLo ?? c.CategoryName),
|
|
|
c.CategorySlug,
|
|
c.CategorySlug,
|
|
|
- description = lang == "en"
|
|
|
|
|
- ? (c.DescriptionEn ?? c.Description)
|
|
|
|
|
- : (c.DescriptionLo ?? c.Description),
|
|
|
|
|
|
|
+ description = lang == "en" ? (c.DescriptionEn ?? c.Description)
|
|
|
|
|
+ : lang == "vi" ? c.Description
|
|
|
|
|
+ : (c.DescriptionLo ?? c.Description),
|
|
|
c.IconUrl,
|
|
c.IconUrl,
|
|
|
c.DisplayOrder
|
|
c.DisplayOrder
|
|
|
})
|
|
})
|
|
@@ -266,7 +266,7 @@ namespace Esim.Apis.Business
|
|
|
int pageSize = request.pageSize <= 0 ? 10 : request.pageSize;
|
|
int pageSize = request.pageSize <= 0 ? 10 : request.pageSize;
|
|
|
|
|
|
|
|
var query = dbContext.Faqs
|
|
var query = dbContext.Faqs
|
|
|
- .Where(f => f.Status == true);
|
|
|
|
|
|
|
+ .Where(f => f.Status.HasValue && f.Status.Value);
|
|
|
|
|
|
|
|
if (request.categoryId.HasValue)
|
|
if (request.categoryId.HasValue)
|
|
|
{
|
|
{
|
|
@@ -275,7 +275,7 @@ namespace Esim.Apis.Business
|
|
|
|
|
|
|
|
if (request.isFeatured.HasValue && request.isFeatured.Value)
|
|
if (request.isFeatured.HasValue && request.isFeatured.Value)
|
|
|
{
|
|
{
|
|
|
- query = query.Where(f => f.IsFeatured == true);
|
|
|
|
|
|
|
+ query = query.Where(f => f.IsFeatured.HasValue && f.IsFeatured.Value);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
int totalCount = query.Count();
|
|
int totalCount = query.Count();
|
|
@@ -289,12 +289,12 @@ namespace Esim.Apis.Business
|
|
|
.Select(f => new
|
|
.Select(f => new
|
|
|
{
|
|
{
|
|
|
f.Id,
|
|
f.Id,
|
|
|
- question = lang == "en"
|
|
|
|
|
- ? (f.QuestionEn ?? f.Question)
|
|
|
|
|
- : (f.QuestionLo ?? f.Question),
|
|
|
|
|
- answer = lang == "en"
|
|
|
|
|
- ? (f.AnswerEn ?? f.Answer)
|
|
|
|
|
- : (f.AnswerLo ?? f.Answer),
|
|
|
|
|
|
|
+ question = lang == "en" ? (f.QuestionEn ?? f.Question)
|
|
|
|
|
+ : lang == "vi" ? f.Question
|
|
|
|
|
+ : (f.QuestionLo ?? f.Question),
|
|
|
|
|
+ answer = lang == "en" ? (f.AnswerEn ?? f.Answer)
|
|
|
|
|
+ : lang == "vi" ? f.Answer
|
|
|
|
|
+ : (f.AnswerLo ?? f.Answer),
|
|
|
f.CategoryId,
|
|
f.CategoryId,
|
|
|
f.ViewCount,
|
|
f.ViewCount,
|
|
|
f.IsFeatured
|
|
f.IsFeatured
|
|
@@ -336,7 +336,7 @@ namespace Esim.Apis.Business
|
|
|
|
|
|
|
|
// Base query - only active devices
|
|
// Base query - only active devices
|
|
|
var query = dbContext.DeviceEsimCompatibilities
|
|
var query = dbContext.DeviceEsimCompatibilities
|
|
|
- .Where(d => d.Status == true && d.SupportsEsim == true);
|
|
|
|
|
|
|
+ .Where(d => d.Status.HasValue && d.Status.Value && d.SupportsEsim.HasValue && d.SupportsEsim.Value);
|
|
|
|
|
|
|
|
// Filter by brand
|
|
// Filter by brand
|
|
|
if (!string.IsNullOrEmpty(request.brand))
|
|
if (!string.IsNullOrEmpty(request.brand))
|
|
@@ -353,7 +353,7 @@ namespace Esim.Apis.Business
|
|
|
// Filter by popular flag
|
|
// Filter by popular flag
|
|
|
if (request.isPopular.HasValue && request.isPopular.Value)
|
|
if (request.isPopular.HasValue && request.isPopular.Value)
|
|
|
{
|
|
{
|
|
|
- query = query.Where(d => d.IsPopular == true);
|
|
|
|
|
|
|
+ query = query.Where(d => d.IsPopular.HasValue && d.IsPopular.Value);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Search by keyword in model name (all language variants)
|
|
// Search by keyword in model name (all language variants)
|
|
@@ -382,13 +382,13 @@ namespace Esim.Apis.Business
|
|
|
{
|
|
{
|
|
|
d.Id,
|
|
d.Id,
|
|
|
d.Brand,
|
|
d.Brand,
|
|
|
- modelName = lang == "en"
|
|
|
|
|
- ? (d.ModelNameEn ?? d.ModelName)
|
|
|
|
|
- : (d.ModelNameLo ?? d.ModelName),
|
|
|
|
|
|
|
+ modelName = lang == "en" ? (d.ModelNameEn ?? d.ModelName)
|
|
|
|
|
+ : lang == "vi" ? d.ModelName
|
|
|
|
|
+ : (d.ModelNameLo ?? d.ModelName),
|
|
|
d.Category,
|
|
d.Category,
|
|
|
- notes = lang == "en"
|
|
|
|
|
- ? (d.NotesEn ?? d.Notes)
|
|
|
|
|
- : (d.NotesLo ?? d.Notes),
|
|
|
|
|
|
|
+ notes = lang == "en" ? (d.NotesEn ?? d.Notes)
|
|
|
|
|
+ : lang == "vi" ? d.Notes
|
|
|
|
|
+ : (d.NotesLo ?? d.Notes),
|
|
|
supportsEsim = d.SupportsEsim ?? true,
|
|
supportsEsim = d.SupportsEsim ?? true,
|
|
|
isPopular = d.IsPopular ?? false,
|
|
isPopular = d.IsPopular ?? false,
|
|
|
displayOrder = d.DisplayOrder ?? 999
|
|
displayOrder = d.DisplayOrder ?? 999
|
|
@@ -438,7 +438,7 @@ namespace Esim.Apis.Business
|
|
|
|
|
|
|
|
// Get all active devices for client-side filtering
|
|
// Get all active devices for client-side filtering
|
|
|
var allDevices = dbContext.DeviceEsimCompatibilities
|
|
var allDevices = dbContext.DeviceEsimCompatibilities
|
|
|
- .Where(d => d.Status == true && d.SupportsEsim == true)
|
|
|
|
|
|
|
+ .Where(d => d.Status.HasValue && d.Status.Value && d.SupportsEsim.HasValue && d.SupportsEsim.Value)
|
|
|
.OrderBy(d => d.DisplayOrder)
|
|
.OrderBy(d => d.DisplayOrder)
|
|
|
.ThenBy(d => d.ModelName)
|
|
.ThenBy(d => d.ModelName)
|
|
|
.ToList();
|
|
.ToList();
|
|
@@ -450,19 +450,19 @@ namespace Esim.Apis.Business
|
|
|
{
|
|
{
|
|
|
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.HasValue && d.IsPopular.Value),
|
|
|
devices = g.Select(d => new
|
|
devices = g.Select(d => new
|
|
|
{
|
|
{
|
|
|
d.Id,
|
|
d.Id,
|
|
|
- modelName = lang == "en"
|
|
|
|
|
- ? (d.ModelNameEn ?? d.ModelName)
|
|
|
|
|
- : (d.ModelNameLo ?? d.ModelName),
|
|
|
|
|
|
|
+ modelName = lang == "en" ? (d.ModelNameEn ?? d.ModelName)
|
|
|
|
|
+ : lang == "vi" ? d.ModelName
|
|
|
|
|
+ : (d.ModelNameLo ?? d.ModelName),
|
|
|
d.Category,
|
|
d.Category,
|
|
|
d.IsPopular,
|
|
d.IsPopular,
|
|
|
d.DisplayOrder,
|
|
d.DisplayOrder,
|
|
|
- notes = lang == "en"
|
|
|
|
|
- ? (d.NotesEn ?? d.Notes)
|
|
|
|
|
- : (d.NotesLo ?? d.Notes)
|
|
|
|
|
|
|
+ notes = lang == "en" ? (d.NotesEn ?? d.Notes)
|
|
|
|
|
+ : lang == "vi" ? d.Notes
|
|
|
|
|
+ : (d.NotesLo ?? d.Notes)
|
|
|
}).ToList()
|
|
}).ToList()
|
|
|
})
|
|
})
|
|
|
.OrderBy(b => b.brand)
|
|
.OrderBy(b => b.brand)
|