Что то типо выборки

This commit is contained in:
Artyom_Yashin 2024-05-02 15:48:52 +04:00
parent cdf8bb4b28
commit 26558beae3
7 changed files with 11 additions and 5 deletions

View File

@ -1,9 +1,9 @@

@{
ViewData["Title"] = "OperationDelete";
ViewData["Title"] = "OperationUpdate";
}
<div class="text-center">
<h2 class="display-4">Удаление операции</h2>
<h2 class="display-4">Обновление операции</h2>
</div>
<form method="post">
<div class="row">

View File

@ -13,5 +13,6 @@ namespace BankContracts.SearchModels
public DateTime? DateTo { get; set; }
public int? SenderCardId { get; set; }
public int? RecipientCardId { get; set; }
public int? CardId { get; set; }
}
}

View File

@ -14,5 +14,6 @@ namespace BankContracts.SearchModels
public DateTime? DateTo { get; set; }
public string? CardNumber { get; set; }
public RequestStatus? Status { get; set; }
public int? CardId { get; set; }
}
}

View File

@ -14,5 +14,6 @@ namespace BankContracts.SearchModels
public int? OperationId { get; set; }
public int? SenderAccountId { get; set; }
public int? RecipientAccountId { get; set; }
public int? CardId { get; set; }
}
}

View File

@ -27,7 +27,8 @@ namespace BankDatabaseImplement.Implements
.Where(x => (
(!model.Id.HasValue || x.Id == model.Id) &&
(!model.DateFrom.HasValue || x.OperationTime >= model.DateFrom ) &&
(!model.DateTo.HasValue || x.OperationTime <= model.DateTo)
(!model.DateTo.HasValue || x.OperationTime <= model.DateTo) &&
(!model.CardId.HasValue || x.RecipientCardId == model.CardId || x.SenderCardId == model.CardId)
)).Select(x => x.GetViewModel).ToList();
}
public OperationViewModel? GetElement(OperationSearchModel model)

View File

@ -31,7 +31,8 @@ namespace BankDatabaseImplement.Implements
return context.Requests.Include(x => x.Cards).ThenInclude(x => x.Card)
.Where(x => (model.Id.HasValue && x.Id == model.Id) &&
(!model.DateFrom.HasValue || x.RequestTime >= model.DateFrom) &&
(!model.DateTo.HasValue || x.RequestTime <= model.DateTo)
(!model.DateTo.HasValue || x.RequestTime <= model.DateTo) &&
(!model.CardId.HasValue || x.Cards.Select(x => x.CardId).ToList().Contains(model.CardId.Value))
).ToList()
.Select(x => x.GetViewModel).ToList();
}

View File

@ -37,7 +37,8 @@ namespace BankDatabaseImplement.Implements
(!model.RecipientAccountId.HasValue || x.RecipientAccountId == model.RecipientAccountId) &&
(!model.OperationId.HasValue || x.OperationId == model.OperationId) &&
(!model.DateFrom.HasValue || x.TransferTime >= model.DateFrom) &&
(!model.DateTo.HasValue || x.TransferTime <= model.DateTo)
(!model.DateTo.HasValue || x.TransferTime <= model.DateTo) &&
(!model.CardId.HasValue || x.Operation.RecipientCardId == model.CardId || x.Operation.SenderCardId == model.CardId)
).Select(x => x.GetViewModel).ToList();
}