From f623e8c1912b20ac48714ec3da35886fc7f25d58 Mon Sep 17 00:00:00 2001 From: Garrigue Benjamin <93991961+Wyveth@users.noreply.github.com> Date: Wed, 29 Nov 2023 01:31:46 +0100 Subject: [PATCH] Update ControllerWith Generic, TODO mapper with object --- WebApiScrapingData.Domain/Class/TypePok.cs | 9 --- .../Repository/Class/AttaqueRepository.cs | 4 +- .../Repository/Class/GameRepository.cs | 12 +-- .../Repository/Class/PokemonRepository.cs | 78 ++++++++++-------- .../Repository/GenericClass/Repository.cs | 5 +- .../Controllers/Abstract/GenericController.cs | 2 +- .../Controllers/AttaqueController.cs | 7 +- .../Controllers/PokemonController.cs | 32 ++------ .../Controllers/TalentController.cs | 39 ++------- .../Controllers/TypeAttaqueController.cs | 32 ++------ .../Controllers/TypePokController.cs | 34 ++------ WepApiScrapingData/DTOs/Concrete/GameDto.cs | 3 +- .../DTOs/Concrete/PokemonDto.cs | 79 +++++++++++++++++++ WepApiScrapingData/DTOs/Concrete/TalentDto.cs | 46 +++++++++++ .../DTOs/Concrete/TypeAttaqueDto.cs | 47 +++++++++++ .../DTOs/Concrete/TypePokDto.cs | 67 ++++++++++++++++ .../ExtensionMethods/DIMethods.cs | 42 +++++----- 17 files changed, 340 insertions(+), 198 deletions(-) create mode 100644 WepApiScrapingData/DTOs/Concrete/PokemonDto.cs create mode 100644 WepApiScrapingData/DTOs/Concrete/TalentDto.cs create mode 100644 WepApiScrapingData/DTOs/Concrete/TypeAttaqueDto.cs create mode 100644 WepApiScrapingData/DTOs/Concrete/TypePokDto.cs diff --git a/WebApiScrapingData.Domain/Class/TypePok.cs b/WebApiScrapingData.Domain/Class/TypePok.cs index ed2a64a..56f1582 100644 --- a/WebApiScrapingData.Domain/Class/TypePok.cs +++ b/WebApiScrapingData.Domain/Class/TypePok.cs @@ -7,55 +7,46 @@ namespace WebApiScrapingData.Domain.Class [DataContract] public class TypePok : Identity { - //French Name [DataMember(Name = DataMember.Name_FR)] public string? Name_FR { get; set; } [DataMember(Name = DataMember.UrlMiniHome_FR)] public string? PathMiniHome_FR { get; set; } - //English Name [DataMember(Name = DataMember.Name_EN)] public string? Name_EN { get; set; } [DataMember(Name = DataMember.UrlMiniHome_EN)] public string? PathMiniHome_EN { get; set; } - //Spanish Name [DataMember(Name = DataMember.Name_ES)] public string? Name_ES { get; set; } [DataMember(Name = DataMember.UrlMiniHome_ES)] public string? PathMiniHome_ES { get; set; } - //Italian Name [DataMember(Name = DataMember.Name_IT)] public string? Name_IT { get; set; } [DataMember(Name = DataMember.UrlMiniHome_IT)] public string? PathMiniHome_IT { get; set; } - //German Name [DataMember(Name = DataMember.Name_DE)] public string? Name_DE { get; set; } [DataMember(Name = DataMember.UrlMiniHome_DE)] public string? PathMiniHome_DE { get; set; } - //Russian Name [DataMember(Name = DataMember.Name_RU)] public string? Name_RU { get; set; } [DataMember(Name = DataMember.UrlMiniHome_RU)] public string? PathMiniHome_RU { get; set; } - //Korean Name [DataMember(Name = DataMember.Name_CO)] public string? Name_CO { get; set; } [DataMember(Name = DataMember.UrlMiniHome_CO)] public string? PathMiniHome_CO { get; set; } - //Chinese Name [DataMember(Name = DataMember.Name_CN)] public string? Name_CN { get; set; } [DataMember(Name = DataMember.UrlMiniHome_CN)] public string? PathMiniHome_CN { get; set; } - //Japanese Name [DataMember(Name = DataMember.Name_JP)] public string? Name_JP { get; set; } [DataMember(Name = DataMember.UrlMiniHome_JP)] diff --git a/WebApiScrapingData.Infrastructure/Repository/Class/AttaqueRepository.cs b/WebApiScrapingData.Infrastructure/Repository/Class/AttaqueRepository.cs index 8a43c34..bcf1ce5 100644 --- a/WebApiScrapingData.Infrastructure/Repository/Class/AttaqueRepository.cs +++ b/WebApiScrapingData.Infrastructure/Repository/Class/AttaqueRepository.cs @@ -19,12 +19,12 @@ public override async Task> Find(Expression m.typeAttaque).Include(m => m.typePok).Where(predicate ?? (s => true)).ToListAsync(); } - public override async Task Get(int id) + public override async Task Get(int id) { return await this._context.Attaques.Include(m => m.typeAttaque).Include(m => m.typePok).SingleAsync(x => x.Id.Equals(id)); } - public async Task GetByName(string name) + public async Task GetByName(string name) { return await this._context.Attaques.Include(m => m.typeAttaque).Include(m => m.typePok).SingleAsync(x => x.Name_FR.Equals(name)); } diff --git a/WebApiScrapingData.Infrastructure/Repository/Class/GameRepository.cs b/WebApiScrapingData.Infrastructure/Repository/Class/GameRepository.cs index b3683bd..f753254 100644 --- a/WebApiScrapingData.Infrastructure/Repository/Class/GameRepository.cs +++ b/WebApiScrapingData.Infrastructure/Repository/Class/GameRepository.cs @@ -1,5 +1,4 @@ -using Microsoft.EntityFrameworkCore; -using WebApiScrapingData.Infrastructure.Repository.Generic; +using WebApiScrapingData.Infrastructure.Repository.Generic; using WebApiScrapingData.Domain.Class; using WebApiScrapingData.Infrastructure.Data; @@ -10,14 +9,5 @@ public class GameRepository : Repository #region Constructor public GameRepository(ScrapingContext context) : base(context) { } #endregion - - #region Public Methods - #region Read - public async Task GetByName(string name) - { - return await this._context.Games.SingleAsync(x => x.Name_FR.Equals(name)); - } - #endregion - #endregion } } diff --git a/WebApiScrapingData.Infrastructure/Repository/Class/PokemonRepository.cs b/WebApiScrapingData.Infrastructure/Repository/Class/PokemonRepository.cs index ecd40e7..03f1cf2 100644 --- a/WebApiScrapingData.Infrastructure/Repository/Class/PokemonRepository.cs +++ b/WebApiScrapingData.Infrastructure/Repository/Class/PokemonRepository.cs @@ -56,26 +56,28 @@ public async Task SaveJsonInDb(string json) #endregion #region Read - public IEnumerable Find(Expression> predicate) + public override async Task> Find(Expression> predicate) { - return _context.Pokemons - .Include("FR") - .Include("EN") - .Include("ES") - .Include("IT") - .Include("DE") - .Include("RU") - .Include("CO") - .Include("CN") - .Include("JP") + return await _context.Pokemons + .Include(m => m.FR) + .Include(m => m.EN) + .Include(m => m.ES) + .Include(m => m.IT) + .Include(m => m.DE) + .Include(m => m.RU) + .Include(m => m.CO) + .Include(m => m.CN) + .Include(m => m.JP) .Include(m => m.Pokemon_TypePoks).ThenInclude(u => u.TypePok) .Include(m => m.Pokemon_Weaknesses).ThenInclude(u => u.TypePok) .Include(m => m.Pokemon_Talents).ThenInclude(u => u.Talent) - .Where(predicate) - .AsQueryable(); + .Include(m => m.Pokemon_Attaques).ThenInclude(u => u.Attaque).ThenInclude(u => u.typePok) + .Include(m => m.Pokemon_Attaques).ThenInclude(u => u.Attaque).ThenInclude(u => u.typeAttaque) + .Include(m => m.Game) + .Where(predicate ?? (s => true)).ToListAsync(); } - public async Task Get(int id) + public override async Task Get(int id) { return await _context.Pokemons .Include(m => m.FR) @@ -87,30 +89,36 @@ public async Task Get(int id) .Include(m => m.CO) .Include(m => m.CN) .Include(m => m.JP) - //.Include(m => m.Pokemon_TypePoks).ThenInclude(u => u.TypePok) - //.Include(m => m.Pokemon_Weaknesses).ThenInclude(u => u.TypePok) - //.Include(m => m.Pokemon_Talents).ThenInclude(u => u.Talent) - //.Include(m => m.Pokemon_Attaques).ThenInclude(u => u.Attaque).ThenInclude(u => u.typePok) - //.Include(m => m.Pokemon_Attaques).ThenInclude(u => u.Attaque).ThenInclude(u => u.typeAttaque) + .Include(m => m.Pokemon_TypePoks).ThenInclude(u => u.TypePok) + .Include(m => m.Pokemon_Weaknesses).ThenInclude(u => u.TypePok) + .Include(m => m.Pokemon_Talents).ThenInclude(u => u.Talent) + .Include(m => m.Pokemon_Attaques).ThenInclude(u => u.Attaque).ThenInclude(u => u.typePok) + .Include(m => m.Pokemon_Attaques).ThenInclude(u => u.Attaque).ThenInclude(u => u.typeAttaque) .SingleAsync(x => x.Id.Equals(id)); } - public IQueryable Query() + public override IQueryable Query() { return _context.Pokemons - .Include("FR") - .Include("EN") - .Include("ES") - .Include("IT") - .Include("DE") - .Include("RU") - .Include("CO") - .Include("CN") - .Include("JP") + .Include(m => m.FR) + .Include(m => m.EN) + .Include(m => m.ES) + .Include(m => m.IT) + .Include(m => m.DE) + .Include(m => m.RU) + .Include(m => m.CO) + .Include(m => m.CN) + .Include(m => m.JP) + .Include(m => m.Pokemon_TypePoks).ThenInclude(u => u.TypePok) + .Include(m => m.Pokemon_Weaknesses).ThenInclude(u => u.TypePok) + .Include(m => m.Pokemon_Talents).ThenInclude(u => u.Talent) + .Include(m => m.Pokemon_Attaques).ThenInclude(u => u.Attaque).ThenInclude(u => u.typePok) + .Include(m => m.Pokemon_Attaques).ThenInclude(u => u.Attaque).ThenInclude(u => u.typeAttaque) + .Include(m => m.Game) .AsQueryable(); } - public async Task> GetAll() + public override async Task> GetAll() { return await _context.Pokemons .Include(m => m.FR) @@ -146,20 +154,20 @@ public async Task> GetAllLight() .Include(m => m.Pokemon_TypePoks).ThenInclude(u => u.TypePok) .ToListAsync(); } - - public Task> GetFamilyWithoutVariantAsync(string family) + + public async Task> GetFamilyWithoutVariantAsync(string family) { string[] vs = family.Split(','); List result = new List(); - + foreach (var item in vs) { - Pokemon pokemon = Find(m => m.FR.Name.Equals(item)).FirstOrDefault(); + Pokemon pokemon = Find(m => m.FR.Name.Equals(item)).Result.FirstOrDefault(); if (pokemon != null) result.Add(pokemon); } - return Task.FromResult(result); + return await Task.FromResult(result); } public async Task> GetAllVariantAsync(string number) diff --git a/WebApiScrapingData.Infrastructure/Repository/GenericClass/Repository.cs b/WebApiScrapingData.Infrastructure/Repository/GenericClass/Repository.cs index 8cb0b37..9d372c4 100644 --- a/WebApiScrapingData.Infrastructure/Repository/GenericClass/Repository.cs +++ b/WebApiScrapingData.Infrastructure/Repository/GenericClass/Repository.cs @@ -1,5 +1,4 @@ using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.ChangeTracking; using System.Linq.Expressions; using WebApiScrapingData.Core.Repositories; using WebApiScrapingData.Domain.Interface; @@ -14,10 +13,12 @@ public class Repository : IRepository where T : class, ITIdentity protected readonly ScrapingContext _context; #endregion + #region Constructor public Repository(ScrapingContext context) { _context = context; } + #endregion #region Public Methods #region Read @@ -95,11 +96,13 @@ public bool RemoveRange(IEnumerable entities) } #endregion + #region Import/Export public Task SaveJsonInDb(string json) { throw new NotImplementedException(); } #endregion + #endregion #region Private Methods private void UpdateInfo(T entity, bool edit = false) diff --git a/WepApiScrapingData/Controllers/Abstract/GenericController.cs b/WepApiScrapingData/Controllers/Abstract/GenericController.cs index 637bab1..f7dc9db 100644 --- a/WepApiScrapingData/Controllers/Abstract/GenericController.cs +++ b/WepApiScrapingData/Controllers/Abstract/GenericController.cs @@ -21,7 +21,7 @@ public abstract class GenericController : ControllerBase #endregion #region Constructor - public GenericController(ILogger logger, GenericMapper mapper, R repository) + protected GenericController(ILogger logger, GenericMapper mapper, R repository) { _logger = logger; _mapper = mapper; diff --git a/WepApiScrapingData/Controllers/AttaqueController.cs b/WepApiScrapingData/Controllers/AttaqueController.cs index 13ce478..2aa1c5a 100644 --- a/WepApiScrapingData/Controllers/AttaqueController.cs +++ b/WepApiScrapingData/Controllers/AttaqueController.cs @@ -3,7 +3,6 @@ using WebApiScrapingData.Core; using WebApiScrapingData.Domain.Class; using WebApiScrapingData.Infrastructure.Repository.Class; -using WebApiScrapingData.Infrastructure.Repository.Generic; using WepApiScrapingData.Controllers.Abstract; using WepApiScrapingData.DTOs.Concrete; using WepApiScrapingData.ExtensionMethods; @@ -21,11 +20,13 @@ public AttaqueController(ILogger logger, GenericMapper> GetFindByName(string name) + public async Task GetFindByName(string name) { - return await _repository.Find(m => m.Name_FR.Equals(name)); + return await _repository.GetByName(name); } + #endregion } } diff --git a/WepApiScrapingData/Controllers/PokemonController.cs b/WepApiScrapingData/Controllers/PokemonController.cs index 22a7844..890b7be 100644 --- a/WepApiScrapingData/Controllers/PokemonController.cs +++ b/WepApiScrapingData/Controllers/PokemonController.cs @@ -1,9 +1,11 @@ -using HtmlAgilityPack; -using Microsoft.AspNetCore.Cors; +using Microsoft.AspNetCore.Cors; using Microsoft.AspNetCore.Mvc; +using WebApiScrapingData.Core; using WebApiScrapingData.Domain.Body; using WebApiScrapingData.Domain.Class; using WebApiScrapingData.Infrastructure.Repository.Class; +using WepApiScrapingData.Controllers.Abstract; +using WepApiScrapingData.DTOs.Concrete; using WepApiScrapingData.ExtensionMethods; namespace WepApiScrapingData.Controllers @@ -11,26 +13,15 @@ namespace WepApiScrapingData.Controllers [ApiController] [Route("api/v1.0/[controller]")] [EnableCors(SecurityMethods.DEFAULT_POLICY)] - public class PokemonController : ControllerBase + public class PokemonController : GenericController { - #region Fields - private readonly PokemonRepository _repository; - #endregion - #region Constructors - public PokemonController(PokemonRepository repository) + public PokemonController(ILogger logger, GenericMapper mapper, PokemonRepository repository) : base(logger, mapper, repository) { - _repository = repository; } #endregion #region Public Methods - [HttpGet] - public async Task> GetAll() - { - return await _repository.GetAll(); - } - [HttpGet] [Route("{limit}/{max}")] public async Task> GetAllinDB(int max = 20, bool limit = true) @@ -53,23 +44,16 @@ public async Task> GetAllLight(int max = 20, bool limit = t return pokemons; } - [HttpGet] - [Route("{id}")] - public async Task GetSingle(int id) - { - return await _repository.Get(id); - } - [HttpGet] [Route("FindByName/{name}")] - public IEnumerable GetFindByName(string name) + public Task> GetFindByName(string name) { return _repository.Find(m => m.FR.Name.Equals(name)); } [HttpGet] [Route("FindByNumber/{number}")] - public IEnumerable GetFindByNumber(string number) + public Task> GetFindByNumber(string number) { return _repository.Find(m => m.Number.Equals(number)); } diff --git a/WepApiScrapingData/Controllers/TalentController.cs b/WepApiScrapingData/Controllers/TalentController.cs index 0d7ac6e..323f118 100644 --- a/WepApiScrapingData/Controllers/TalentController.cs +++ b/WepApiScrapingData/Controllers/TalentController.cs @@ -1,8 +1,10 @@ using Microsoft.AspNetCore.Cors; using Microsoft.AspNetCore.Mvc; -using System.Linq.Expressions; +using WebApiScrapingData.Core; using WebApiScrapingData.Domain.Class; -using WebApiScrapingData.Infrastructure.Repository.Generic; +using WebApiScrapingData.Infrastructure.Repository.Class; +using WepApiScrapingData.Controllers.Abstract; +using WepApiScrapingData.DTOs.Concrete; using WepApiScrapingData.ExtensionMethods; namespace WepApiScrapingData.Controllers @@ -10,40 +12,11 @@ namespace WepApiScrapingData.Controllers [ApiController] [Route("api/v1.0/[controller]")] [EnableCors(SecurityMethods.DEFAULT_POLICY)] - public class TalentController : ControllerBase + public class TalentController : GenericController { - #region Fields - private readonly Repository _repository; - private readonly Repository _repositoryPokemon; - #endregion - #region Constructors - public TalentController(Repository repository, Repository repositoryPokemon) - { - _repository = repository; - _repositoryPokemon = repositoryPokemon; - } - #endregion - - #region Public Methods - [HttpGet] - public async Task> GetAll() - { - return await _repository.GetAll(); - } - - [HttpGet] - [Route("{id}")] - public async Task GetSingle(int id) - { - return await _repository.Get(id); - } - - [HttpGet] - [Route("Find")] - public async Task> GetFind(Expression> predicate) + public TalentController(ILogger logger, GenericMapper mapper, TalentRepository repository) : base(logger, mapper, repository) { - return await _repository.Find(predicate); } #endregion } diff --git a/WepApiScrapingData/Controllers/TypeAttaqueController.cs b/WepApiScrapingData/Controllers/TypeAttaqueController.cs index 27a99e4..3866d0f 100644 --- a/WepApiScrapingData/Controllers/TypeAttaqueController.cs +++ b/WepApiScrapingData/Controllers/TypeAttaqueController.cs @@ -1,7 +1,11 @@ using Microsoft.AspNetCore.Cors; using Microsoft.AspNetCore.Mvc; +using WebApiScrapingData.Core; using WebApiScrapingData.Domain.Class; +using WebApiScrapingData.Infrastructure.Repository.Class; using WebApiScrapingData.Infrastructure.Repository.Generic; +using WepApiScrapingData.Controllers.Abstract; +using WepApiScrapingData.DTOs.Concrete; using WepApiScrapingData.ExtensionMethods; namespace WepApiScrapingData.Controllers @@ -10,41 +14,21 @@ namespace WepApiScrapingData.Controllers [ApiController] [Route("api/v1.0/[controller]")] [EnableCors(SecurityMethods.DEFAULT_POLICY)] - public class TypeAttaqueController : ControllerBase + public class TypeAttaqueController : GenericController { - #region Fields - private readonly Repository _repository; - private readonly Repository _repositoryTP; - private readonly Repository _repositoryA; - #endregion - #region Constructors - public TypeAttaqueController(Repository repository, Repository repositoryTP, Repository repositoryA) + public TypeAttaqueController(ILogger logger, GenericMapper mapper, TypeAttaqueRepository repository) : base(logger, mapper, repository) { - _repository = repository; - _repositoryTP = repositoryTP; - _repositoryA = repositoryA; } #endregion - [HttpGet] - public async Task> GetAll() - { - return await _repository.GetAll(); - } - - [HttpGet] - [Route("{id}")] - public async Task GetSingle(int id) - { - return await _repository.Get(id); - } - + #region Public Methods [HttpGet] [Route("FindByName/{name}")] public async Task> GetFindByName(string name) { return await _repository.Find(m => m.Name_FR.Equals(name)); } + #endregion } } diff --git a/WepApiScrapingData/Controllers/TypePokController.cs b/WepApiScrapingData/Controllers/TypePokController.cs index 3f0c3b4..b8f7990 100644 --- a/WepApiScrapingData/Controllers/TypePokController.cs +++ b/WepApiScrapingData/Controllers/TypePokController.cs @@ -1,8 +1,11 @@ using Microsoft.AspNetCore.Cors; using Microsoft.AspNetCore.Mvc; using System.Linq.Expressions; +using WebApiScrapingData.Core; using WebApiScrapingData.Domain.Class; using WebApiScrapingData.Infrastructure.Repository.Class; +using WepApiScrapingData.Controllers.Abstract; +using WepApiScrapingData.DTOs.Concrete; using WepApiScrapingData.ExtensionMethods; namespace WepApiScrapingData.Controllers @@ -10,38 +13,11 @@ namespace WepApiScrapingData.Controllers [ApiController] [Route("api/v1.0/[controller]")] [EnableCors(SecurityMethods.DEFAULT_POLICY)] - public class TypePokController : ControllerBase + public class TypePokController : GenericController { - #region Fields - private readonly TypePokRepository _repository; - #endregion - #region Constructors - public TypePokController(TypePokRepository repository) - { - _repository = repository; - } - #endregion - - #region Public Methods - [HttpGet] - public async Task> GetAll() - { - return await _repository.GetAll(); - } - - [HttpGet] - [Route("{id}")] - public async Task GetSingle(int id) - { - return await _repository.Get(id); - } - - [HttpGet] - [Route("Find")] - public async Task> GetFind(Expression> predicate) + public TypePokController(ILogger logger, GenericMapper mapper, TypePokRepository repository) : base(logger, mapper, repository) { - return await _repository.Find(predicate); } #endregion } diff --git a/WepApiScrapingData/DTOs/Concrete/GameDto.cs b/WepApiScrapingData/DTOs/Concrete/GameDto.cs index f3caf93..92f97af 100644 --- a/WepApiScrapingData/DTOs/Concrete/GameDto.cs +++ b/WepApiScrapingData/DTOs/Concrete/GameDto.cs @@ -1,5 +1,4 @@ -using System.Runtime.Serialization; -using WepApiScrapingData.DTOs.Abstract; +using WepApiScrapingData.DTOs.Abstract; namespace WepApiScrapingData.DTOs.Concrete { diff --git a/WepApiScrapingData/DTOs/Concrete/PokemonDto.cs b/WepApiScrapingData/DTOs/Concrete/PokemonDto.cs new file mode 100644 index 0000000..f3b119b --- /dev/null +++ b/WepApiScrapingData/DTOs/Concrete/PokemonDto.cs @@ -0,0 +1,79 @@ +using WebApiScrapingData.Domain.Class; +using WepApiScrapingData.DTOs.Abstract; + +namespace WepApiScrapingData.DTOs.Concrete +{ + public class PokemonDto : IdentityDto + { + public string? Number { get; set; } + + public long Id_FR { get; set; } + + public long Id_EN { get; set; } + + public long Id_ES { get; set; } + + public long Id_IT { get; set; } + + public long Id_DE { get; set; } + + public long Id_RU { get; set; } + + public long Id_CO { get; set; } + + public long Id_CN { get; set; } + + public long Id_JP { get; set; } + + public List Pokemon_TypePoks { get; set; } + public List Pokemon_Weaknesses { get; set; } + public List Pokemon_Talents { get; set; } + public List Pokemon_Attaques { get; set; } + + public string? TypeEvolution { get; set; } + + public int StatPv { get; set; } + + public int StatAttaque { get; set; } + + public int StatDefense { get; set; } + + public int StatAttaqueSpe { get; set; } + + public int StatDefenseSpe { get; set; } + + public int StatVitesse { get; set; } + + public int StatTotal { get; set; } + + public string? EggMoves { get; set; } + + public string? CaptureRate { get; set; } + + public string? BasicHappiness { get; set; } + + public int Generation { get; set; } + + public string? UrlImg { get; set; } + + public string? PathImg { get; set; } + + public string? UrlSprite { get; set; } + + public string? PathSprite { get; set; } + + public string? UrlSound { get; set; } + + public string? PathSound { get; set; } + + public long Game { get; set; } + + public PokemonDto() + { + Pokemon_TypePoks = new List(); + Pokemon_Weaknesses = new List(); + Pokemon_Talents = new List(); + Pokemon_Attaques = new List(); + } + } +} diff --git a/WepApiScrapingData/DTOs/Concrete/TalentDto.cs b/WepApiScrapingData/DTOs/Concrete/TalentDto.cs new file mode 100644 index 0000000..0f0aaf5 --- /dev/null +++ b/WepApiScrapingData/DTOs/Concrete/TalentDto.cs @@ -0,0 +1,46 @@ +using WebApiScrapingData.Domain.Class; +using WepApiScrapingData.DTOs.Abstract; + +namespace WepApiScrapingData.DTOs.Concrete +{ + public class TalentDto : IdentityDto + { + public string? Name_FR { get; set; } + + public string? Description_FR { get; set; } + + public string? Name_EN { get; set; } + + public string? Description_EN { get; set; } + + public string? Name_ES { get; set; } + + public string? Description_ES { get; set; } + + public string? Name_IT { get; set; } + + public string? Description_IT { get; set; } + + public string? Name_DE { get; set; } + + public string? Description_DE { get; set; } + + public string? Name_RU { get; set; } + + public string? Description_RU { get; set; } + + public string? Name_CO { get; set; } + + public string? Description_CO { get; set; } + + public string? Name_CN { get; set; } + + public string? Description_CN { get; set; } + + public string? Name_JP { get; set; } + + public string? Description_JP { get; set; } + + public List? Pokemon_Talents { get; set; } + } +} diff --git a/WepApiScrapingData/DTOs/Concrete/TypeAttaqueDto.cs b/WepApiScrapingData/DTOs/Concrete/TypeAttaqueDto.cs new file mode 100644 index 0000000..ab409d1 --- /dev/null +++ b/WepApiScrapingData/DTOs/Concrete/TypeAttaqueDto.cs @@ -0,0 +1,47 @@ +using WepApiScrapingData.DTOs.Abstract; + +namespace WepApiScrapingData.DTOs.Concrete +{ + public class TypeAttaqueDto : IdentityDto + { + public string? Name_FR { get; set; } + + public string? Description_FR { get; set; } + + public string? Name_EN { get; set; } + + public string? Description_EN { get; set; } + + public string? Name_ES { get; set; } + + public string? Description_ES { get; set; } + + public string? Name_IT { get; set; } + + public string? Description_IT { get; set; } + + public string? Name_DE { get; set; } + + public string? Description_DE { get; set; } + + public string? Name_RU { get; set; } + + public string? Description_RU { get; set; } + + public string? Name_CO { get; set; } + + public string? Description_CO { get; set; } + + public string? Name_CN { get; set; } + + public string? Description_CN { get; set; } + + public string? Name_JP { get; set; } + + public string? Description_JP { get; set; } + + public string? UrlImg { get; set; } + + public string? PathImg { get; set; } + } +} diff --git a/WepApiScrapingData/DTOs/Concrete/TypePokDto.cs b/WepApiScrapingData/DTOs/Concrete/TypePokDto.cs new file mode 100644 index 0000000..f26d0d5 --- /dev/null +++ b/WepApiScrapingData/DTOs/Concrete/TypePokDto.cs @@ -0,0 +1,67 @@ +using WepApiScrapingData.DTOs.Abstract; + +namespace WepApiScrapingData.DTOs.Concrete +{ + public class TypePokDto : IdentityDto + { + public string? Name_FR { get; set; } + + public string? PathMiniHome_FR { get; set; } + + public string? Name_EN { get; set; } + + public string? PathMiniHome_EN { get; set; } + + public string? Name_ES { get; set; } + + public string? PathMiniHome_ES { get; set; } + + public string? Name_IT { get; set; } + + public string? PathMiniHome_IT { get; set; } + + public string? Name_DE { get; set; } + + public string? PathMiniHome_DE { get; set; } + + public string? Name_RU { get; set; } + + public string? PathMiniHome_RU { get; set; } + + public string? Name_CO { get; set; } + + public string? PathMiniHome_CO { get; set; } + + public string? Name_CN { get; set; } + + public string? PathMiniHome_CN { get; set; } + + public string? Name_JP { get; set; } + + public string? PathMiniHome_JP { get; set; } + + public string? UrlMiniHome { get; set; } + + public string? UrlMiniGo { get; set; } + public string? PathMiniGo { get; set; } + + public string? UrlFondGo { get; set; } + public string? PathFondGo { get; set; } + + public string? UrlIconHome { get; set; } + public string? PathIconHome { get; set; } + + public string? UrlAutoHome { get; set; } + public string? PathAutoHome { get; set; } + + public string? ImgColor { get; set; } + + public string? InfoColor { get; set; } + + public string? TypeColor { get; set; } + + public List? Pokemon_TypePoks { get; set; } + + public List? Pokemon_Weaknesses { get; set; } + } +} diff --git a/WepApiScrapingData/ExtensionMethods/DIMethods.cs b/WepApiScrapingData/ExtensionMethods/DIMethods.cs index 2901b5d..72c1193 100644 --- a/WepApiScrapingData/ExtensionMethods/DIMethods.cs +++ b/WepApiScrapingData/ExtensionMethods/DIMethods.cs @@ -1,7 +1,4 @@ -using WebApiScrapingData.Domain.Class; -using WebApiScrapingData.Domain.Class.Quizz; -using WebApiScrapingData.Infrastructure.Repository; -using WebApiScrapingData.Infrastructure.Repository.Generic; +using WebApiScrapingData.Infrastructure.Repository; using WebApiScrapingData.Infrastructure.Repository.Class; using WebApiScrapingData.Core; @@ -16,30 +13,27 @@ public static class DIMethods /// public static IServiceCollection AddInjections(this IServiceCollection services) { - services.AddScoped, AttaqueRepository>(); - services.AddScoped, GameRepository>(); - services.AddScoped(); - services.AddScoped, TalentRepository>(); - services.AddScoped, TypeAttaqueRepository>(); - services.AddScoped, TypePokRepository>(); - services.AddScoped, Pokemon_TypePokRepository>(); - services.AddScoped, Pokemon_WeaknessRepository>(); - services.AddScoped, Pokemon_TalentRepository>(); - services.AddScoped, Pokemon_AttaqueRepository>(); - - #region Quizz - services.AddScoped, QuizzRepository>(); - services.AddScoped, QuestionRepository>(); - services.AddScoped, AnswerRepository>(); - services.AddScoped, QuestionTypeRepository>(); - services.AddScoped, QuizzDifficultyRepository>(); - services.AddScoped, DifficultyRepository>(); - #endregion - #region Controller services.AddScoped(typeof(GenericMapper<,>)); services.AddScoped(); services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + + #region Quizz + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + #endregion #endregion return services;