Skip to content

Commit

Permalink
Research Create
Browse files Browse the repository at this point in the history
  • Loading branch information
Wyveth committed Jul 12, 2023
1 parent da2e8ca commit af1ae8e
Show file tree
Hide file tree
Showing 3 changed files with 114 additions and 7 deletions.
97 changes: 97 additions & 0 deletions WebApiScrapingData.Domain/Body/Research.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WebApiScrapingData.Domain.Body
{
public class Research
{
public List<TypePokR>? TypePok { get; set; }
public List<TypeLearnR>? TypeLearn { get; set; }
public List<TalentPokR>? TalentPok { get; set; }
public bool Hidden { get; set; }
public Interval? Interval { get; set; }
public List<Height>? Height { get; set; }
public List<Weight>? Weight { get; set; }
}

public class TypeLearnR
{
public string Code { get; set; }

public TypeLearnR(string code)
{
Code = code;
}
}

public class TalentPokR
{
public string Code { get; set; }

public TalentPokR(string code)
{
Code = code;
}
}

public class TypePokR
{
public string Code { get; set; }
public string CodeType { get; set; }

public TypePokR(string code, string codeType)
{
Code = code;
CodeType = codeType;
}
}

public class Interval
{
public int First { get; set; }
public int Last { get; set; }

public Interval(int first, int last)
{
First = first;
Last = last;
}
}

public class Height
{
// Small From 0 to 0.9m (2'11")

// Normal From 1.0m to 1.8m (from 3'03" to 5'11")

// Big 1.9m (6'03")
public string Code { get; set; }

public Height(string code)
{
Code = code;
}
}

public class Weight : Code
{
// Small From 0 to 24,9 kg (from 0 to 54.9 lbs)

// Normal From 25 to 99,9 kg (from 55.1 to 220.2 lbs)

// Big 100 kg (220.5 lbs)

public Weight(string code)
{
id = code;
}
}

public class Code
{
public string? id { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -352,11 +352,11 @@ public async Task<Pokemon> 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));
}

Expand Down Expand Up @@ -390,7 +390,8 @@ public async Task<IEnumerable<Pokemon>> GetAll()
.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(m => m.typeAttaque)
.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)
.ToListAsync();
}
Expand Down
11 changes: 10 additions & 1 deletion WepApiScrapingData/Controllers/PokemonController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Diagnostics;
using WebApiScrapingData.Core.Repositories;
using WebApiScrapingData.Core.Repositories.RepositoriesQuizz;
using WebApiScrapingData.Domain.Body;
using WebApiScrapingData.Domain.Class;
using WebApiScrapingData.Domain.ClassJson;
using WepApiScrapingData.ExtensionMethods;
Expand Down Expand Up @@ -310,6 +311,15 @@ public IEnumerable<Pokemon> GetFindByNumber(string number)
return _repository.Find(m => m.Number.Equals(number));
}

[HttpGet]
[Route("Research")]
public async Task<IEnumerable<Pokemon>> Research([FromBody] Research research, string loc)
{
IEnumerable<Pokemon> pokemons = await _repository.GetAllLight();
return null;
//return pokemons.Where(m => m.);
}

[HttpGet]
[Route("GetEvol/{family}")]
public async Task<IEnumerable<Pokemon>> GetEvol(string family)
Expand Down Expand Up @@ -523,7 +533,6 @@ public async Task GenerateJsonXamarinV2()
Debug.WriteLine("End Creation Json - " + DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss"));
}


[HttpGet]
[Route("ExportDb")]
public Task ExportDb()
Expand Down

0 comments on commit af1ae8e

Please sign in to comment.