react-version #1
@ -38,7 +38,7 @@ public class ImageController : ControllerBase {
|
|||||||
string path, filename, filetype;
|
string path, filename, filetype;
|
||||||
IQueryable<ProductModel> query;
|
IQueryable<ProductModel> query;
|
||||||
|
|
||||||
if (_cache is not null)
|
if (_cache is not null && _cache.isOk())
|
||||||
query = _cache.queryCache();
|
query = _cache.queryCache();
|
||||||
else query = _context.Products;
|
else query = _context.Products;
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ public class ImageController : ControllerBase {
|
|||||||
Path.GetFileNameWithoutExtension(filename) +
|
Path.GetFileNameWithoutExtension(filename) +
|
||||||
(thumbnail == true ? "_thumbnail" : "") +
|
(thumbnail == true ? "_thumbnail" : "") +
|
||||||
Path.GetExtension(filename));
|
Path.GetExtension(filename));
|
||||||
|
|
||||||
if (!System.IO.File.Exists(path)) {
|
if (!System.IO.File.Exists(path)) {
|
||||||
_logger.LogError(8, "Unable to find image. Sending default image instead...");
|
_logger.LogError(8, "Unable to find image. Sending default image instead...");
|
||||||
path = Path.Combine(_hostEnvironment.ContentRootPath, "Images", "default.jpg");
|
path = Path.Combine(_hostEnvironment.ContentRootPath, "Images", "default.jpg");
|
||||||
|
@ -116,7 +116,7 @@ public class DatabaseCacheService {
|
|||||||
}
|
}
|
||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
public IQueryable<ProductModel> queryCache() {
|
public IQueryable<ProductModel>? queryCache() {
|
||||||
if (!_ok)
|
if (!_ok)
|
||||||
return null;
|
return null;
|
||||||
try {
|
try {
|
||||||
|
Loading…
Reference in New Issue
Block a user