Add ProfileId filter and navigation property to OutRes
Enhanced `ReadOutResHandler` to support filtering by `ProfileId` when querying `OutRes` entities. This was implemented by adding a condition to filter results based on the `ProfileId` of the associated `Action`. Updated the `OutRes` class to include a navigation property `Action`, annotated with `[ForeignKey]` to link it to the `ActionId` column. This establishes a relationship between `OutRes` and `RecAction`, improving data access and maintainability.
This commit is contained in:
parent
2de0b5bfa3
commit
aa34bdd279
@ -23,6 +23,9 @@ public class ReadOutResHandler(IRepository<OutRes> repo, IMapper mapper) : IRequ
|
|||||||
if(request.ActionId is long actionId)
|
if(request.ActionId is long actionId)
|
||||||
q = q.Where(res => res.ActionId == actionId);
|
q = q.Where(res => res.ActionId == actionId);
|
||||||
|
|
||||||
|
if(request.ProfileId is long profileId)
|
||||||
|
q = q.Where(res => res.Action!.ProfileId == profileId);
|
||||||
|
|
||||||
var dtos = await q.ToListAsync(cancel);
|
var dtos = await q.ToListAsync(cancel);
|
||||||
|
|
||||||
return mapper.Map<OutResDto>(dtos);
|
return mapper.Map<OutResDto>(dtos);
|
||||||
|
|||||||
@ -14,6 +14,9 @@ public class OutRes
|
|||||||
[Column("ACTION_ID")]
|
[Column("ACTION_ID")]
|
||||||
public long? ActionId { get; set; }
|
public long? ActionId { get; set; }
|
||||||
|
|
||||||
|
[ForeignKey("ActionId")]
|
||||||
|
public RecAction? Action { get; set; }
|
||||||
|
|
||||||
[Column("RESULT_HEADER")]
|
[Column("RESULT_HEADER")]
|
||||||
public string? Header { get; set; }
|
public string? Header { get; set; }
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user