|
|
|
@ -1,4 +1,5 @@ |
|
|
|
using ApplicationCore.Interfaces; |
|
|
|
using ApplicationCore.Exceptions; |
|
|
|
using ApplicationCore.Interfaces; |
|
|
|
using Microsoft.AspNetCore.Hosting; |
|
|
|
using System.IO; |
|
|
|
|
|
|
|
@ -13,10 +14,17 @@ namespace Infrastructure.FileSystem |
|
|
|
_env = env; |
|
|
|
} |
|
|
|
public byte[] GetImageBytesById(int id) |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
var contentRoot = _env.ContentRootPath + "//Pics"; |
|
|
|
var path = Path.Combine(contentRoot, id + ".png"); |
|
|
|
return File.ReadAllBytes(path); |
|
|
|
} |
|
|
|
catch (FileNotFoundException ex) |
|
|
|
{ |
|
|
|
throw new CatalogImageMissingException(ex); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|