|
|
|
@ -28,50 +28,61 @@ namespace Business
|
|
|
|
|
|
|
|
|
|
public async Task<IEnumerable<Champion?>> GetItems(int index, int count, string? orderingPropertyName = null, bool descending = false)
|
|
|
|
|
{
|
|
|
|
|
return parent.DbContext.champions.Select(c =>c.ToModel())
|
|
|
|
|
.Skip(index * count).Take(count);
|
|
|
|
|
return parent.DbContext.champions.GetItemsWithFilterAndOrdering(
|
|
|
|
|
c => true,
|
|
|
|
|
index, count,
|
|
|
|
|
orderingPropertyName, descending).Select(c => c.ToModel());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task<IEnumerable<Champion?>> GetItemsByCharacteristic(string charName, int index, int count, string? orderingPropertyName = null, bool descending = false)
|
|
|
|
|
{
|
|
|
|
|
return parent.DbContext.champions.Where(c => c.Characteristics.Any(ch => ch.Name.Equals(charName)))
|
|
|
|
|
.Select(c => c.ToModel())
|
|
|
|
|
.Skip(index * count).Take(count);
|
|
|
|
|
|
|
|
|
|
return parent.DbContext.champions.GetItemsWithFilterAndOrdering(
|
|
|
|
|
c => c.Characteristics.Any(ch => ch.Name.Equals(charName)),
|
|
|
|
|
index, count,
|
|
|
|
|
orderingPropertyName, descending).Select(c => c.ToModel());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task<IEnumerable<Champion?>> GetItemsByClass(ChampionClass championClass, int index, int count, string? orderingPropertyName = null, bool descending = false)
|
|
|
|
|
{
|
|
|
|
|
return parent.DbContext.champions.Where(c => c.Class.Equals(championClass))
|
|
|
|
|
.Select(c => c.ToModel())
|
|
|
|
|
.Skip(index * count).Take(count);
|
|
|
|
|
return parent.DbContext.champions.GetItemsWithFilterAndOrdering(
|
|
|
|
|
c => c.Class.Equals(championClass),
|
|
|
|
|
index, count,
|
|
|
|
|
orderingPropertyName, descending).Select(c => c.ToModel());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task<IEnumerable<Champion?>> GetItemsByName(string substring, int index, int count, string? orderingPropertyName = null, bool descending = false)
|
|
|
|
|
{
|
|
|
|
|
return parent.DbContext.champions.Where(c => c.Name.Contains(substring))
|
|
|
|
|
.Select(c => c.ToModel())
|
|
|
|
|
.Skip(index * count).Take(count);
|
|
|
|
|
return parent.DbContext.champions.GetItemsWithFilterAndOrdering(
|
|
|
|
|
c => c.Name.Contains(substring),
|
|
|
|
|
index, count,
|
|
|
|
|
orderingPropertyName, descending).Select(c => c.ToModel());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task<IEnumerable<Champion?>> GetItemsByRunePage(RunePage? runePage, int index, int count, string? orderingPropertyName = null, bool descending = false)
|
|
|
|
|
{
|
|
|
|
|
return parent.DbContext.champions.Where(c => c.runepages.Any(rp => rp.Equals(runePage.ToEntity())))
|
|
|
|
|
.Select(c => c.ToModel())
|
|
|
|
|
.Skip(index * count).Take(count);
|
|
|
|
|
|
|
|
|
|
return parent.DbContext.champions.GetItemsWithFilterAndOrdering(
|
|
|
|
|
c => c.runepages.Any(rp => rp.Equals(runePage.ToEntity())),
|
|
|
|
|
index, count,
|
|
|
|
|
orderingPropertyName, descending).Select(c => c.ToModel());
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task<IEnumerable<Champion?>> GetItemsBySkill(Skill? skill, int index, int count, string? orderingPropertyName = null, bool descending = false)
|
|
|
|
|
{
|
|
|
|
|
return parent.DbContext.champions.Where(c => skill!=null && c.Skills.Any(s => s.Name.Equals(skill.Name)))
|
|
|
|
|
.Select(c => c.ToModel())
|
|
|
|
|
.Skip(index * count).Take(count);
|
|
|
|
|
return parent.DbContext.champions.GetItemsWithFilterAndOrdering(
|
|
|
|
|
c => skill != null && c.Skills.Any(s => s.Name.Equals(skill.Name)),
|
|
|
|
|
index, count,
|
|
|
|
|
orderingPropertyName, descending).Select(c => c.ToModel());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task<IEnumerable<Champion?>> GetItemsBySkill(string skill, int index, int count, string? orderingPropertyName = null, bool descending = false)
|
|
|
|
|
{
|
|
|
|
|
return parent.DbContext.champions.Where(c => skill != null && c.Skills.Any(s => s.Name.Equals(skill)))
|
|
|
|
|
.Select(c => c.ToModel())
|
|
|
|
|
.Skip(index * count).Take(count);
|
|
|
|
|
return parent.DbContext.champions.GetItemsWithFilterAndOrdering(
|
|
|
|
|
c => skill != null && c.Skills.Any(s => s.Name.Equals(skill)),
|
|
|
|
|
index, count,
|
|
|
|
|
orderingPropertyName, descending).Select(c => c.ToModel());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task<int> GetNbItems()
|
|
|
|
|