lien entre appMobile et api avec champion marche (avec un bug)
continuous-integration/drone/push Build was killed Details

master
Jolys Enzo 2 years ago
parent 279237c3d9
commit 3adec1b76a

@ -112,9 +112,9 @@ namespace Api_lol.Controllers
[HttpGet]
[Route("/GetItems")]
public async Task<IEnumerable<Champion?>> GetItems(int index,int count,string? propertyName = null, bool descending = false)
public async Task<IEnumerable<DtoChampions?>> GetItems(int index,int count,string? propertyName = null, bool descending = false)
{
return await data.ChampionsMgr.GetItems(index, count, propertyName, descending);
return (await data.ChampionsMgr.GetItems(index, count, propertyName, descending)).Select(e => e.ModelToDto());
}
[HttpGet]

@ -1,14 +1,22 @@
// See https://aka.ms/new-console-template for more information
using DTO;
using EntityFramwork.Manager;
using Model;
using System.Net.Http;
using System.Net.Http.Json;
Console.WriteLine("Start !");
Manager manager = new Manager();
//IEnumerable<Champion?> tmp = await manager.ChampionsMgr.GetItems(2, 4);
HttpClient http = new HttpClient();
Console.ReadLine();
Console.WriteLine(await manager.ChampionsMgr.GetNbItems());
IEnumerable<DtoChampions> champions = await http.GetFromJsonAsync<IEnumerable<DtoChampions>>("https://localhost:7081/GetItems?index=0&count=6&descending=false");
Console.WriteLine(champions.ToList().FirstOrDefault().name);
Console.ReadLine();
Console.WriteLine("End !");

@ -6,6 +6,8 @@ using System.Diagnostics;
using System.Xml.Linq;
using System.ComponentModel;
using Model.enums;
using StubLib;
using EntityFramwork.Factories;
namespace EntityFramwork
{
@ -95,6 +97,26 @@ namespace EntityFramwork
.ValueGeneratedOnAdd();
// ---------------------------------- Stub --------------------------------------//
DataStub dataStub = new DataStub();
List<Champion> champions = dataStub.champions;
List<EntityLargeImage> listImage = new List<EntityLargeImage>();
List<EntityChampions> listChampions = new List<EntityChampions>();
int i = 1;
foreach (var champion in champions)
{
listImage.Add(new EntityLargeImage() { Id = i, Base64 = champion.Image.Base64 });
EntityChampions tmpChamp = champion.ChampionModelToEntity();
tmpChamp.Id = i;
tmpChamp.ImageId = i;
listChampions.Add(tmpChamp);
i++;
}
modelBuilder.Entity<EntityChampions>().HasData(listChampions);
modelBuilder.Entity<EntityLargeImage>().HasData(listImage);
/*
// Ajout Image
int nbImage = 29;
List<EntityLargeImage> listImage = new List<EntityLargeImage>();
@ -167,6 +189,7 @@ namespace EntityFramwork
new EntityCategorieRune() { Id = 3,Category = CategoriePageRune.Other.ToString(),IdPageRune = pageRune[2].Id , IdRune = runes[2].Id },
};
modelBuilder.Entity<EntityCategorieRune>().HasData(categorieRune);
*/
}
public DbSet<EntityChampions> Champions { get; set; }

File diff suppressed because one or more lines are too long

@ -17,6 +17,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\SourcesMobileApp\StubLib\StubLib.csproj" />
<ProjectReference Include="..\DTO\DTO.csproj" />
<ProjectReference Include="..\Model\Model.csproj" />
</ItemGroup>

@ -1,703 +0,0 @@
// <auto-generated />
using EntityFramwork;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace EntityFramwork.Migrations
{
[DbContext(typeof(BDDContext))]
[Migration("20230321151711_test")]
partial class test
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "7.0.2");
modelBuilder.Entity("EntityFramwork.EntityCategorieRune", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Category")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("IdPageRune")
.HasColumnType("INTEGER");
b.Property<int>("IdRune")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("IdPageRune");
b.HasIndex("IdRune");
b.ToTable("CategorieRunes");
b.HasData(
new
{
Id = 1,
Category = "Major",
IdPageRune = 1,
IdRune = 1
},
new
{
Id = 2,
Category = "Minor",
IdPageRune = 2,
IdRune = 2
},
new
{
Id = 3,
Category = "Other",
IdPageRune = 3,
IdRune = 3
});
});
modelBuilder.Entity("EntityFramwork.EntityChampions", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Bio")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Classe")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Icon")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("ImageId")
.HasColumnType("INTEGER");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("ImageId")
.IsUnique();
b.HasIndex("Name")
.IsUnique();
b.ToTable("Champions");
b.HasData(
new
{
Id = 1,
Bio = "Inconnu !",
Classe = "Assassin",
Icon = "Inconnu !",
ImageId = 1,
Name = "Akali"
},
new
{
Id = 2,
Bio = "Inconnu !",
Classe = "Fighter",
Icon = "Inconnu !",
ImageId = 2,
Name = "Aatrox"
},
new
{
Id = 3,
Bio = "Inconnu !",
Classe = "Mage",
Icon = "Inconnu !",
ImageId = 3,
Name = "Ahri"
},
new
{
Id = 4,
Bio = "Inconnu !",
Classe = "Marksman",
Icon = "Inconnu !",
ImageId = 4,
Name = "Akshan"
},
new
{
Id = 5,
Bio = "Inconnu !",
Classe = "Support",
Icon = "Inconnu !",
ImageId = 5,
Name = "Bard"
},
new
{
Id = 6,
Bio = "Inconnu !",
Classe = "Tank",
Icon = "Inconnu !",
ImageId = 6,
Name = "Alistar"
});
});
modelBuilder.Entity("EntityFramwork.EntityLargeImage", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Base64")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("Images");
b.HasData(
new
{
Id = 1,
Base64 = "Inconnu !"
},
new
{
Id = 2,
Base64 = "Inconnu !"
},
new
{
Id = 3,
Base64 = "Inconnu !"
},
new
{
Id = 4,
Base64 = "Inconnu !"
},
new
{
Id = 5,
Base64 = "Inconnu !"
},
new
{
Id = 6,
Base64 = "Inconnu !"
},
new
{
Id = 7,
Base64 = "Inconnu !"
},
new
{
Id = 8,
Base64 = "Inconnu !"
},
new
{
Id = 9,
Base64 = "Inconnu !"
},
new
{
Id = 10,
Base64 = "Inconnu !"
},
new
{
Id = 11,
Base64 = "Inconnu !"
},
new
{
Id = 12,
Base64 = "Inconnu !"
},
new
{
Id = 13,
Base64 = "Inconnu !"
},
new
{
Id = 14,
Base64 = "Inconnu !"
},
new
{
Id = 15,
Base64 = "Inconnu !"
},
new
{
Id = 16,
Base64 = "Inconnu !"
},
new
{
Id = 17,
Base64 = "Inconnu !"
},
new
{
Id = 18,
Base64 = "Inconnu !"
},
new
{
Id = 19,
Base64 = "Inconnu !"
},
new
{
Id = 20,
Base64 = "Inconnu !"
},
new
{
Id = 21,
Base64 = "Inconnu !"
},
new
{
Id = 22,
Base64 = "Inconnu !"
},
new
{
Id = 23,
Base64 = "Inconnu !"
},
new
{
Id = 24,
Base64 = "Inconnu !"
},
new
{
Id = 25,
Base64 = "Inconnu !"
},
new
{
Id = 26,
Base64 = "Inconnu !"
},
new
{
Id = 27,
Base64 = "Inconnu !"
},
new
{
Id = 28,
Base64 = "Inconnu !"
},
new
{
Id = 29,
Base64 = "Inconnu !"
});
});
modelBuilder.Entity("EntityFramwork.EntityPageRune", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("PageRunes");
b.HasData(
new
{
Id = 1,
Name = "Inconnu !"
},
new
{
Id = 2,
Name = "Inconnu !"
},
new
{
Id = 3,
Name = "Inconnu !"
});
});
modelBuilder.Entity("EntityFramwork.EntityRunes", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Family")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Icon")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("ImageId")
.HasColumnType("INTEGER");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("ImageId")
.IsUnique();
b.ToTable("Runes");
b.HasData(
new
{
Id = 1,
Description = "Inconnu !",
Family = "Precision",
Icon = "Inconnu !",
ImageId = 16,
Name = "Inconnu !"
},
new
{
Id = 2,
Description = "Inconnu !",
Family = "Domination",
Icon = "Inconnu !",
ImageId = 17,
Name = "Inconnu !"
},
new
{
Id = 3,
Description = "Inconnu !",
Family = "Unknown",
Icon = "Inconnu !",
ImageId = 18,
Name = "Inconnu !"
});
});
modelBuilder.Entity("EntityFramwork.EntitySkill", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("ChampionId")
.HasColumnType("INTEGER");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("ChampionId");
b.ToTable("Skills");
b.HasData(
new
{
Id = 1,
ChampionId = 1,
Description = "Inconnu !",
Name = "Inconnu !",
Type = "Basic"
},
new
{
Id = 2,
ChampionId = 2,
Description = "Inconnu !",
Name = "Inconnu !",
Type = "Ultimate"
},
new
{
Id = 3,
ChampionId = 3,
Description = "Inconnu !",
Name = "Inconnu !",
Type = "Unknown"
});
});
modelBuilder.Entity("EntityFramwork.EntitySkins", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("ChampionId")
.HasColumnType("INTEGER");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Icon")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("ImageId")
.HasColumnType("INTEGER");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.Property<float>("Price")
.HasColumnType("REAL");
b.HasKey("Id");
b.HasIndex("ChampionId");
b.HasIndex("ImageId")
.IsUnique();
b.ToTable("Skins");
b.HasData(
new
{
Id = 1,
ChampionId = 1,
Description = "Inconnu !",
Icon = "Inconnu !",
ImageId = 7,
Name = "Stinger",
Price = 0f
},
new
{
Id = 2,
ChampionId = 1,
Description = "Inconnu !",
Icon = "Inconnu !",
ImageId = 8,
Name = "Infernal",
Price = 0f
},
new
{
Id = 3,
ChampionId = 1,
Description = "Inconnu !",
Icon = "Inconnu !",
ImageId = 9,
Name = "All-Star",
Price = 0f
},
new
{
Id = 4,
ChampionId = 2,
Description = "Inconnu !",
Icon = "Inconnu !",
ImageId = 10,
Name = "Justicar",
Price = 0f
},
new
{
Id = 5,
ChampionId = 2,
Description = "Inconnu !",
Icon = "Inconnu !",
ImageId = 11,
Name = "Mecha",
Price = 0f
},
new
{
Id = 6,
ChampionId = 3,
Description = "Inconnu !",
Icon = "Inconnu !",
ImageId = 12,
Name = "Dynasty",
Price = 0f
},
new
{
Id = 7,
ChampionId = 4,
Description = "Inconnu !",
Icon = "Inconnu !",
ImageId = 13,
Name = "Cyber Pop",
Price = 0f
},
new
{
Id = 8,
ChampionId = 5,
Description = "Inconnu !",
Icon = "Inconnu !",
ImageId = 14,
Name = "Elderwood",
Price = 0f
},
new
{
Id = 9,
ChampionId = 6,
Description = "Inconnu !",
Icon = "Inconnu !",
ImageId = 15,
Name = "Black",
Price = 0f
});
});
modelBuilder.Entity("EntityFramwork.EntityCategorieRune", b =>
{
b.HasOne("EntityFramwork.EntityPageRune", "PageRune")
.WithMany("CategorieRune")
.HasForeignKey("IdPageRune")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("EntityFramwork.EntityRunes", "Rune")
.WithMany("CategorieRune")
.HasForeignKey("IdRune")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("PageRune");
b.Navigation("Rune");
});
modelBuilder.Entity("EntityFramwork.EntityChampions", b =>
{
b.HasOne("EntityFramwork.EntityLargeImage", "Image")
.WithOne("Champion")
.HasForeignKey("EntityFramwork.EntityChampions", "ImageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Image");
});
modelBuilder.Entity("EntityFramwork.EntityRunes", b =>
{
b.HasOne("EntityFramwork.EntityLargeImage", "Image")
.WithOne("Rune")
.HasForeignKey("EntityFramwork.EntityRunes", "ImageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Image");
});
modelBuilder.Entity("EntityFramwork.EntitySkill", b =>
{
b.HasOne("EntityFramwork.EntityChampions", "Champions")
.WithMany("Skills")
.HasForeignKey("ChampionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Champions");
});
modelBuilder.Entity("EntityFramwork.EntitySkins", b =>
{
b.HasOne("EntityFramwork.EntityChampions", "Champion")
.WithMany("Skins")
.HasForeignKey("ChampionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("EntityFramwork.EntityLargeImage", "Image")
.WithOne("Skin")
.HasForeignKey("EntityFramwork.EntitySkins", "ImageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Champion");
b.Navigation("Image");
});
modelBuilder.Entity("EntityFramwork.EntityChampions", b =>
{
b.Navigation("Skills");
b.Navigation("Skins");
});
modelBuilder.Entity("EntityFramwork.EntityLargeImage", b =>
{
b.Navigation("Champion")
.IsRequired();
b.Navigation("Rune")
.IsRequired();
b.Navigation("Skin")
.IsRequired();
});
modelBuilder.Entity("EntityFramwork.EntityPageRune", b =>
{
b.Navigation("CategorieRune");
});
modelBuilder.Entity("EntityFramwork.EntityRunes", b =>
{
b.Navigation("CategorieRune");
});
#pragma warning restore 612, 618
}
}
}

@ -1,341 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
namespace EntityFramwork.Migrations
{
/// <inheritdoc />
public partial class test : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Images",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Base64 = table.Column<string>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Images", x => x.Id);
});
migrationBuilder.CreateTable(
name: "PageRunes",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Name = table.Column<string>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_PageRunes", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Champions",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Name = table.Column<string>(type: "TEXT", nullable: false),
Bio = table.Column<string>(type: "TEXT", nullable: false),
Icon = table.Column<string>(type: "TEXT", nullable: false),
Classe = table.Column<string>(type: "TEXT", nullable: false),
ImageId = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Champions", x => x.Id);
table.ForeignKey(
name: "FK_Champions_Images_ImageId",
column: x => x.ImageId,
principalTable: "Images",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Runes",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Name = table.Column<string>(type: "TEXT", nullable: false),
Description = table.Column<string>(type: "TEXT", nullable: false),
Icon = table.Column<string>(type: "TEXT", nullable: false),
Family = table.Column<string>(type: "TEXT", nullable: false),
ImageId = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Runes", x => x.Id);
table.ForeignKey(
name: "FK_Runes_Images_ImageId",
column: x => x.ImageId,
principalTable: "Images",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Skills",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Name = table.Column<string>(type: "TEXT", nullable: false),
Description = table.Column<string>(type: "TEXT", nullable: false),
Type = table.Column<string>(type: "TEXT", nullable: false),
ChampionId = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Skills", x => x.Id);
table.ForeignKey(
name: "FK_Skills_Champions_ChampionId",
column: x => x.ChampionId,
principalTable: "Champions",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Skins",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Name = table.Column<string>(type: "TEXT", nullable: false),
Description = table.Column<string>(type: "TEXT", nullable: false),
Icon = table.Column<string>(type: "TEXT", nullable: false),
Price = table.Column<float>(type: "REAL", nullable: false),
ChampionId = table.Column<int>(type: "INTEGER", nullable: false),
ImageId = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Skins", x => x.Id);
table.ForeignKey(
name: "FK_Skins_Champions_ChampionId",
column: x => x.ChampionId,
principalTable: "Champions",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Skins_Images_ImageId",
column: x => x.ImageId,
principalTable: "Images",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "CategorieRunes",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Category = table.Column<string>(type: "TEXT", nullable: false),
IdPageRune = table.Column<int>(type: "INTEGER", nullable: false),
IdRune = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CategorieRunes", x => x.Id);
table.ForeignKey(
name: "FK_CategorieRunes_PageRunes_IdPageRune",
column: x => x.IdPageRune,
principalTable: "PageRunes",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_CategorieRunes_Runes_IdRune",
column: x => x.IdRune,
principalTable: "Runes",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.InsertData(
table: "Images",
columns: new[] { "Id", "Base64" },
values: new object[,]
{
{ 1, "Inconnu !" },
{ 2, "Inconnu !" },
{ 3, "Inconnu !" },
{ 4, "Inconnu !" },
{ 5, "Inconnu !" },
{ 6, "Inconnu !" },
{ 7, "Inconnu !" },
{ 8, "Inconnu !" },
{ 9, "Inconnu !" },
{ 10, "Inconnu !" },
{ 11, "Inconnu !" },
{ 12, "Inconnu !" },
{ 13, "Inconnu !" },
{ 14, "Inconnu !" },
{ 15, "Inconnu !" },
{ 16, "Inconnu !" },
{ 17, "Inconnu !" },
{ 18, "Inconnu !" },
{ 19, "Inconnu !" },
{ 20, "Inconnu !" },
{ 21, "Inconnu !" },
{ 22, "Inconnu !" },
{ 23, "Inconnu !" },
{ 24, "Inconnu !" },
{ 25, "Inconnu !" },
{ 26, "Inconnu !" },
{ 27, "Inconnu !" },
{ 28, "Inconnu !" },
{ 29, "Inconnu !" }
});
migrationBuilder.InsertData(
table: "PageRunes",
columns: new[] { "Id", "Name" },
values: new object[,]
{
{ 1, "Inconnu !" },
{ 2, "Inconnu !" },
{ 3, "Inconnu !" }
});
migrationBuilder.InsertData(
table: "Champions",
columns: new[] { "Id", "Bio", "Classe", "Icon", "ImageId", "Name" },
values: new object[,]
{
{ 1, "Inconnu !", "Assassin", "Inconnu !", 1, "Akali" },
{ 2, "Inconnu !", "Fighter", "Inconnu !", 2, "Aatrox" },
{ 3, "Inconnu !", "Mage", "Inconnu !", 3, "Ahri" },
{ 4, "Inconnu !", "Marksman", "Inconnu !", 4, "Akshan" },
{ 5, "Inconnu !", "Support", "Inconnu !", 5, "Bard" },
{ 6, "Inconnu !", "Tank", "Inconnu !", 6, "Alistar" }
});
migrationBuilder.InsertData(
table: "Runes",
columns: new[] { "Id", "Description", "Family", "Icon", "ImageId", "Name" },
values: new object[,]
{
{ 1, "Inconnu !", "Precision", "Inconnu !", 16, "Inconnu !" },
{ 2, "Inconnu !", "Domination", "Inconnu !", 17, "Inconnu !" },
{ 3, "Inconnu !", "Unknown", "Inconnu !", 18, "Inconnu !" }
});
migrationBuilder.InsertData(
table: "CategorieRunes",
columns: new[] { "Id", "Category", "IdPageRune", "IdRune" },
values: new object[,]
{
{ 1, "Major", 1, 1 },
{ 2, "Minor", 2, 2 },
{ 3, "Other", 3, 3 }
});
migrationBuilder.InsertData(
table: "Skills",
columns: new[] { "Id", "ChampionId", "Description", "Name", "Type" },
values: new object[,]
{
{ 1, 1, "Inconnu !", "Inconnu !", "Basic" },
{ 2, 2, "Inconnu !", "Inconnu !", "Ultimate" },
{ 3, 3, "Inconnu !", "Inconnu !", "Unknown" }
});
migrationBuilder.InsertData(
table: "Skins",
columns: new[] { "Id", "ChampionId", "Description", "Icon", "ImageId", "Name", "Price" },
values: new object[,]
{
{ 1, 1, "Inconnu !", "Inconnu !", 7, "Stinger", 0f },
{ 2, 1, "Inconnu !", "Inconnu !", 8, "Infernal", 0f },
{ 3, 1, "Inconnu !", "Inconnu !", 9, "All-Star", 0f },
{ 4, 2, "Inconnu !", "Inconnu !", 10, "Justicar", 0f },
{ 5, 2, "Inconnu !", "Inconnu !", 11, "Mecha", 0f },
{ 6, 3, "Inconnu !", "Inconnu !", 12, "Dynasty", 0f },
{ 7, 4, "Inconnu !", "Inconnu !", 13, "Cyber Pop", 0f },
{ 8, 5, "Inconnu !", "Inconnu !", 14, "Elderwood", 0f },
{ 9, 6, "Inconnu !", "Inconnu !", 15, "Black", 0f }
});
migrationBuilder.CreateIndex(
name: "IX_CategorieRunes_IdPageRune",
table: "CategorieRunes",
column: "IdPageRune");
migrationBuilder.CreateIndex(
name: "IX_CategorieRunes_IdRune",
table: "CategorieRunes",
column: "IdRune");
migrationBuilder.CreateIndex(
name: "IX_Champions_ImageId",
table: "Champions",
column: "ImageId",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Champions_Name",
table: "Champions",
column: "Name",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Runes_ImageId",
table: "Runes",
column: "ImageId",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Skills_ChampionId",
table: "Skills",
column: "ChampionId");
migrationBuilder.CreateIndex(
name: "IX_Skins_ChampionId",
table: "Skins",
column: "ChampionId");
migrationBuilder.CreateIndex(
name: "IX_Skins_ImageId",
table: "Skins",
column: "ImageId",
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "CategorieRunes");
migrationBuilder.DropTable(
name: "Skills");
migrationBuilder.DropTable(
name: "Skins");
migrationBuilder.DropTable(
name: "PageRunes");
migrationBuilder.DropTable(
name: "Runes");
migrationBuilder.DropTable(
name: "Champions");
migrationBuilder.DropTable(
name: "Images");
}
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -0,0 +1,52 @@
using DTO;
using Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RelationApi.Factories
{
public static class ChampionFacto {
public static Champion DtoToModel(this DtoChampions champDto)
{
ChampionClass classe = ChampionClass.Unknown;
switch (champDto.classe)
{
case "Assassin":
classe = ChampionClass.Assassin;
break;
case "Fighter":
classe = ChampionClass.Fighter;
break;
case "Mage":
classe = ChampionClass.Mage;
break;
case "Support":
classe = ChampionClass.Support;
break;
case "Tank":
classe = ChampionClass.Tank;
break;
}
return new Champion(champDto.name, champClass: classe, icon: champDto.icon, bio: champDto.bio, image: champDto.image);
}
public static DtoChampions ModelToDto(this Champion champ)
{
DtoChampions dto = new DtoChampions();
dto.name = champ.Name;
dto.classe = champ.Class.ToString();
dto.bio = champ.Bio;
dto.icon = champ.Icon;
return dto;
}
}
}

@ -8,6 +8,7 @@
<ItemGroup>
<ProjectReference Include="..\..\SourcesMobileApp\Model\Model.csproj" />
<ProjectReference Include="..\DTO\DTO.csproj" />
</ItemGroup>
</Project>

@ -1,4 +1,6 @@
using Model;
using DTO;
using Model;
using RelationApi.Factories;
using System;
using System.Collections.Generic;
using System.Linq;
@ -32,7 +34,9 @@ namespace RelationApi
public async Task<IEnumerable<Champion?>> GetItems(int index, int count, string? orderingPropertyName = null, bool descending = false)
{
return await _httpClient.GetFromJsonAsync<IEnumerable<Champion?>>(IpApi + "GetItems");
IEnumerable<DtoChampions?> dto = await _httpClient.GetFromJsonAsync<IEnumerable<DtoChampions?>>(IpApi+ "GetItems?index="+index+"&count="+count+"&descending="+descending);
return dto.Select(e => e.DtoToModel()).ToList();
}
public Task<IEnumerable<Champion?>> GetItemsByCharacteristic(string charName, int index, int count, string? orderingPropertyName = null, bool descending = false)

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
 <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net7.0-android;net7.0-ios;net7.0-maccatalyst</TargetFrameworks>
@ -82,6 +82,7 @@
<MauiImage Include="Resources\Images\rp.png" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Sources\RelationApi\RelationApi.csproj" />
<ProjectReference Include="..\Model\Model.csproj" />
<ProjectReference Include="..\Shared\Shared.csproj" />
<ProjectReference Include="..\ViewModels\ViewModels.csproj" />

@ -5,7 +5,6 @@ using Microsoft.Maui.Handlers;
using Microsoft.Maui.Platform;
using Model;
using RelationApi;
using StubLib;
using ViewModels;
namespace LolApp;

File diff suppressed because one or more lines are too long

@ -67,6 +67,7 @@ public partial class ChampionsMgrVM : ObservableObject
public async Task LoadChampions()
{
// CHANGER LA REQUETE ICI
await LoadChampionsFunc(async () => await DataMgr.ChampionsMgr.GetItems(index, count, "Name"),
async () => await DataMgr.ChampionsMgr.GetNbItems(),
LoadingCriterium.None);

@ -9,4 +9,7 @@
<ItemGroup>
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.1.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Model\Model.csproj" />
</ItemGroup>
</Project>

Loading…
Cancel
Save