|
|
|
@ -1,10 +1,7 @@
|
|
|
|
|
using Model;
|
|
|
|
|
using API_LoL_Project.Mapper;
|
|
|
|
|
using Model;
|
|
|
|
|
using Shared;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Data.SqlTypes;
|
|
|
|
|
|
|
|
|
|
namespace Business
|
|
|
|
|
{
|
|
|
|
@ -17,89 +14,112 @@ namespace Business
|
|
|
|
|
public ChampionsManager(DbData parent)
|
|
|
|
|
=> this.parent = parent;
|
|
|
|
|
|
|
|
|
|
public Task<Champion?> AddItem(Champion? item)
|
|
|
|
|
public async Task<Champion?> AddItem(Champion? item)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
await parent.DbContext.champions.AddAsync(item.ToEntity());
|
|
|
|
|
return item;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Task<bool> DeleteItem(Champion? item)
|
|
|
|
|
public async Task<bool> DeleteItem(Champion? item)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
parent.DbContext.champions.Remove(item.ToEntity());
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Task<IEnumerable<Champion?>> GetItems(int index, int count, string? orderingPropertyName = null, bool descending = false)
|
|
|
|
|
public async Task<IEnumerable<Champion?>> GetItems(int index, int count, string? orderingPropertyName = null, bool descending = false)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
return parent.DbContext.champions.Select(c =>c.ToModel())
|
|
|
|
|
.Skip(index * count).Take(count);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Task<IEnumerable<Champion?>> GetItemsByCharacteristic(string charName, int index, int count, string? orderingPropertyName = null, bool descending = false)
|
|
|
|
|
public async Task<IEnumerable<Champion?>> GetItemsByCharacteristic(string charName, int index, int count, string? orderingPropertyName = null, bool descending = false)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
return parent.DbContext.champions.Where(c => c.Characteristics.Any(ch => ch.Name.Equals(charName)))
|
|
|
|
|
.Select(c => c.ToModel())
|
|
|
|
|
.Skip(index * count).Take(count);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Task<IEnumerable<Champion?>> GetItemsByClass(ChampionClass championClass, int index, int count, string? orderingPropertyName = null, bool descending = false)
|
|
|
|
|
public async Task<IEnumerable<Champion?>> GetItemsByClass(ChampionClass championClass, int index, int count, string? orderingPropertyName = null, bool descending = false)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
return parent.DbContext.champions.Where(c => c.Class.Equals(championClass))
|
|
|
|
|
.Select(c => c.ToModel())
|
|
|
|
|
.Skip(index * count).Take(count);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Task<IEnumerable<Champion?>> GetItemsByName(string substring, int index, int count, string? orderingPropertyName = null, bool descending = false)
|
|
|
|
|
public async Task<IEnumerable<Champion?>> GetItemsByName(string substring, int index, int count, string? orderingPropertyName = null, bool descending = false)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
return parent.DbContext.champions.Where(c => c.Name.Contains(substring))
|
|
|
|
|
.Select(c => c.ToModel())
|
|
|
|
|
.Skip(index * count).Take(count);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Task<IEnumerable<Champion?>> GetItemsByRunePage(RunePage? runePage, int index, int count, string? orderingPropertyName = null, bool descending = false)
|
|
|
|
|
public async Task<IEnumerable<Champion?>> GetItemsByRunePage(RunePage? runePage, int index, int count, string? orderingPropertyName = null, bool descending = false)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
return parent.DbContext.champions.Where(c => c.runepages.Any(rp => rp.Equals(runePage.ToEntity())
|
|
|
|
|
.Select(c => c.ToModel())
|
|
|
|
|
.Skip(index * count).Take(count);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Task<IEnumerable<Champion?>> GetItemsBySkill(Skill? skill, int index, int count, string? orderingPropertyName = null, bool descending = false)
|
|
|
|
|
public async Task<IEnumerable<Champion?>> GetItemsBySkill(Skill? skill, int index, int count, string? orderingPropertyName = null, bool descending = false)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Task<IEnumerable<Champion?>> GetItemsBySkill(string skill, int index, int count, string? orderingPropertyName = null, bool descending = false)
|
|
|
|
|
public async Task<IEnumerable<Champion?>> GetItemsBySkill(string skill, int index, int count, string? orderingPropertyName = null, bool descending = false)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Task<int> GetNbItems()
|
|
|
|
|
public async Task<int> GetNbItems()
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
return parent.DbContext.champions.Count();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Task<int> GetNbItemsByCharacteristic(string charName)
|
|
|
|
|
public async Task<int> GetNbItemsByCharacteristic(string charName)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
return parent.DbContext.champions.Where(c => c.Characteristics.Any(ch => ch.Name.Equals(charName))).Count();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Task<int> GetNbItemsByClass(ChampionClass championClass)
|
|
|
|
|
public async Task<int> GetNbItemsByClass(ChampionClass championClass)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
return parent.DbContext.champions.Where(c => c.Class.Equals(championClass))
|
|
|
|
|
.Count();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Task<int> GetNbItemsByName(string substring)
|
|
|
|
|
public async Task<int> GetNbItemsByName(string substring)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
return parent.DbContext.champions.Where(c => c.Name.Contains(substring))
|
|
|
|
|
.Count();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Task<int> GetNbItemsByRunePage(RunePage? runePage)
|
|
|
|
|
public async Task<int> GetNbItemsByRunePage(RunePage? runePage)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
return parent.DbContext.champions.Where(c => c.runepages.Any(rp => rp.Equals(runePage.ToEntity()))).Count();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Task<int> GetNbItemsBySkill(Skill? skill)
|
|
|
|
|
public async Task<int> GetNbItemsBySkill(Skill? skill)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
return parent.DbContext.champions.Where(c => skill != null && c.Skills.Any(s => s.Name.Equals(skill.Name)))
|
|
|
|
|
.Count();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Task<int> GetNbItemsBySkill(string skill)
|
|
|
|
|
public async Task<int> GetNbItemsBySkill(string skill)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
return parent.DbContext.champions.Where(c => skill != null && c.Skills.Any(s => s.Name.Equals(skill)))
|
|
|
|
|
.Count();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Task<Champion?> UpdateItem(Champion? oldItem, Champion? newItem)
|
|
|
|
|
public async Task<Champion?> UpdateItem(Champion? oldItem, Champion? newItem)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
parent.DbContext.champions.Remove(oldItem.ToEntity());
|
|
|
|
|
parent.DbContext.champions.Add(newItem.ToEntity());
|
|
|
|
|
return newItem;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|