|
@@ -13,18 +13,25 @@ namespace Luticate2.Utils.Controllers
|
13
|
13
|
public class LuFsFilesCrudController<TBusiness> : LuController
|
14
|
14
|
where TBusiness : ILuCrudInterface<LuFsFilesAddDbo, LuFsFilesDbo, LuFsFilesAddDbo, string>
|
15
|
15
|
{
|
16
|
|
- private readonly TBusiness _business;
|
|
16
|
+ protected readonly TBusiness Business;
|
17
|
17
|
|
18
|
18
|
public LuFsFilesCrudController(IOptions<LuUtilsOptionsDbo> luUtilsOptionsDbo, TBusiness business) : base(luUtilsOptionsDbo)
|
19
|
19
|
{
|
20
|
|
- _business = business;
|
|
20
|
+ Business = business;
|
|
21
|
+ }
|
|
22
|
+
|
|
23
|
+ [HttpGet]
|
|
24
|
+ [Route("[controller]/{id}")]
|
|
25
|
+ public virtual LuApiWrapperDbo<LuFsFilesDbo> GetSingleById([Required]string id)
|
|
26
|
+ {
|
|
27
|
+ return Handle(Business.GetSingleById(id));
|
21
|
28
|
}
|
22
|
29
|
|
23
|
30
|
[HttpPost]
|
24
|
31
|
[Route("[controller]")]
|
25
|
32
|
public LuApiWrapperDbo<LuFsFilesDbo> AddDbo([Required]IFormFile file, string path)
|
26
|
33
|
{
|
27
|
|
- return Handle(_business.AddDbo(new LuFsFilesAddDbo
|
|
34
|
+ return Handle(Business.AddDbo(new LuFsFilesAddDbo
|
28
|
35
|
{
|
29
|
36
|
File = file.OpenReadStream(),
|
30
|
37
|
Path = string.IsNullOrEmpty(path) ? file.FileName : path
|
|
@@ -35,14 +42,14 @@ namespace Luticate2.Utils.Controllers
|
35
|
42
|
[Route("[controller]")]
|
36
|
43
|
public virtual LuApiWrapperDbo<LuPaginatedDbo<LuFsFilesDbo>> GetMultiple([Required]LuPaginatedRequestDbo request)
|
37
|
44
|
{
|
38
|
|
- return Handle(_business.GetMultiple(request));
|
|
45
|
+ return Handle(Business.GetMultiple(request));
|
39
|
46
|
}
|
40
|
47
|
|
41
|
48
|
[HttpPost]
|
42
|
49
|
[Route("[controller]/{id}")]
|
43
|
50
|
public virtual LuApiWrapperDbo<LuFsFilesDbo> EditSingleByIdDbo([Required]string id, IFormFile file, string path)
|
44
|
51
|
{
|
45
|
|
- return Handle(_business.EditSingleByIdDbo(id, new LuFsFilesAddDbo
|
|
52
|
+ return Handle(Business.EditSingleByIdDbo(id, new LuFsFilesAddDbo
|
46
|
53
|
{
|
47
|
54
|
File = file?.OpenReadStream(),
|
48
|
55
|
Path = path
|
|
@@ -53,7 +60,7 @@ namespace Luticate2.Utils.Controllers
|
53
|
60
|
[Route("[controller]/{id}")]
|
54
|
61
|
public virtual LuApiWrapperDbo<LuFsFilesDbo> Delete([Required]string id)
|
55
|
62
|
{
|
56
|
|
- return Handle(_business.DeleteSingleByIdDbo(id));
|
|
63
|
+ return Handle(Business.DeleteSingleByIdDbo(id));
|
57
|
64
|
}
|
58
|
65
|
}
|
59
|
66
|
}
|