Add Denied and DeniedReason on the SearchViewModel

pull/3344/head
Namaneo 5 years ago
parent 56948035f9
commit f8fcc9bea9

@ -7,6 +7,8 @@ namespace Ombi.Core.Models.Search
{ {
public int Id { get; set; } public int Id { get; set; }
public bool Approved { get; set; } public bool Approved { get; set; }
public bool? Denied { get; set; }
public string DeniedReason { get; set; }
public bool Requested { get; set; } public bool Requested { get; set; }
public int RequestId { get; set; } public int RequestId { get; set; }
public bool Available { get; set; } public bool Available { get; set; }

@ -34,6 +34,8 @@ namespace Ombi.Core.Rule.Rules.Search
obj.Requested = true; obj.Requested = true;
obj.RequestId = movieRequests.Id; obj.RequestId = movieRequests.Id;
obj.Approved = movieRequests.Approved; obj.Approved = movieRequests.Approved;
obj.Denied = movieRequests.Denied ?? false;
obj.DeniedReason = movieRequests.DeniedReason;
obj.Available = movieRequests.Available; obj.Available = movieRequests.Available;
return Success(); return Success();
@ -60,6 +62,8 @@ namespace Ombi.Core.Rule.Rules.Search
request.Requested = true; request.Requested = true;
request.Approved = tvRequests.ChildRequests.Any(x => x.Approved); request.Approved = tvRequests.ChildRequests.Any(x => x.Approved);
request.Denied = tvRequests.ChildRequests.Any(x => x.Denied ?? false);
request.DeniedReason = tvRequests.ChildRequests.FirstOrDefault(x => x.DeniedReason != null)?.DeniedReason;
// Let's modify the seasonsrequested to reflect what we have requested... // Let's modify the seasonsrequested to reflect what we have requested...
foreach (var season in request.SeasonRequests) foreach (var season in request.SeasonRequests)
@ -108,6 +112,8 @@ namespace Ombi.Core.Rule.Rules.Search
obj.Requested = true; obj.Requested = true;
obj.RequestId = albumRequest.Id; obj.RequestId = albumRequest.Id;
obj.Approved = albumRequest.Approved; obj.Approved = albumRequest.Approved;
obj.Denied = albumRequest.Denied;
obj.DeniedReason = albumRequest.DeniedReason;
obj.Available = albumRequest.Available; obj.Available = albumRequest.Available;
return Success(); return Success();

Loading…
Cancel
Save