Assembly components
This commit is contained in:
@@ -23,15 +23,25 @@ namespace ComputerShopDatabaseImplement.Implements
|
||||
public List<ComponentViewModel> GetFilteredList(ComponentSearchModel
|
||||
model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.ComponentName))
|
||||
if (string.IsNullOrEmpty(model.ComponentName) && model.ClientId == null)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
using var context = new ComputerShopDatabase();
|
||||
return context.Components
|
||||
.Where(x => x.ComponentName.Contains(model.ComponentName))
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
if (!string.IsNullOrEmpty(model.ComponentName))
|
||||
{
|
||||
return context.Components
|
||||
.Where(x => x.ComponentName.Contains(model.ComponentName))
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
return context.Components
|
||||
.Where(x => x.ClientId == model.ClientId)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
public ComponentViewModel? GetElement(ComponentSearchModel model)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user