From 7afe310f4edbb761e6cab65de505512206796c8c Mon Sep 17 00:00:00 2001
From: Pierre Ferreira
Date: Fri, 24 Feb 2023 17:19:38 +0100
Subject: [PATCH 1/7] =?UTF-8?q?:package:=20ajout=20de=20l'attribut=20Skill?=
=?UTF-8?q?=20pour=20un=20champion,=20la=20liaison=20=C3=A0=20la=20bdd=20n?=
=?UTF-8?q?'est=20pas=20faite=20car=20si=20on=20utilise=20un=20immutableha?=
=?UTF-8?q?shset,=20il=20faut=20pouvoir=20demander=20a=20entity=20framewor?=
=?UTF-8?q?k=20d'ignorer=20une=20des=20comparaisons=20entre=20hashset=20et?=
=?UTF-8?q?=20immutablehashset?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../API_LoL/Controllers/ChampionsController.cs | 4 ++--
Sources/API_LoL/Mapper/ChampionMapper.cs | 14 ++++++++++----
Sources/Api_UT/UnitTest1.cs | 6 +-----
Sources/DTO/ChampionDTO.cs | 17 +++++++++++++++--
Sources/EntityFramework/ChampionEntity.cs | 12 +++++++-----
Sources/EntityFramework/Skill.cs | 5 ++++-
6 files changed, 39 insertions(+), 19 deletions(-)
diff --git a/Sources/API_LoL/Controllers/ChampionsController.cs b/Sources/API_LoL/Controllers/ChampionsController.cs
index 1d4efad..8ad3719 100644
--- a/Sources/API_LoL/Controllers/ChampionsController.cs
+++ b/Sources/API_LoL/Controllers/ChampionsController.cs
@@ -25,7 +25,7 @@ namespace API_LoL.Controllers
{
var list = await ChampionsManager.GetItems(0,await ChampionsManager.GetNbItems());
if (list.Count() != 0) {
- return Ok(list.Select(champion => champion?.toDTO()));
+ return Ok(list.Select(champion => champion?.ToDTO()));
}else {
return NoContent();
}
@@ -49,7 +49,7 @@ namespace API_LoL.Controllers
}
else
{
- await ChampionsManager.AddItem(champion.toChampion());
+ await ChampionsManager.AddItem(champion.ToChampion());
return CreatedAtAction("Post",champion);
}
}
diff --git a/Sources/API_LoL/Mapper/ChampionMapper.cs b/Sources/API_LoL/Mapper/ChampionMapper.cs
index b380b7e..c2e8d0b 100644
--- a/Sources/API_LoL/Mapper/ChampionMapper.cs
+++ b/Sources/API_LoL/Mapper/ChampionMapper.cs
@@ -9,15 +9,21 @@ namespace DTO.Mapper
{
public static class ChampionMapper
{
- public static ChampionDTO toDTO(this Champion champion)
+ public static ChampionDTO ToDTO(this Champion champion)
{
return new ChampionDTO(champion.Name, champion.Bio, champion.Icon);
+ //return new ChampionDTO(champion.Name, champion.Bio, champion.Icon, champion.Skills);
}
- public static Champion toChampion(this ChampionDTO champion)
+ public static Champion ToChampion(this ChampionDTO champion)
{
- return new Champion(champion.Name, ChampionClass.Unknown, champion.Icon, "", champion.Bio);
-
+ Champion champ = new Champion(champion.Name, ChampionClass.Unknown, champion.Icon, "", champion.Bio);
+
+ //foreach (Skill skill in champion.Skills)
+ //{
+ // champ.AddSkill(skill);
+ //}
+ return champ;
}
}
}
diff --git a/Sources/Api_UT/UnitTest1.cs b/Sources/Api_UT/UnitTest1.cs
index 4c934b2..de78d2b 100644
--- a/Sources/Api_UT/UnitTest1.cs
+++ b/Sources/Api_UT/UnitTest1.cs
@@ -2,12 +2,8 @@ using API_LoL.Controllers;
using DTO;
using FluentAssertions;
using Microsoft.AspNetCore.Mvc;
-using Microsoft.EntityFrameworkCore.Query;
using Model;
using StubLib;
-using System.Collections;
-using System.Collections.Generic;
-using System.Diagnostics;
namespace Api_UT
{
@@ -38,7 +34,7 @@ namespace Api_UT
IActionResult a = await api.Post(new ChampionDTO("nom","bio","icon"));
Assert.IsNotNull(a);
ChampionDTO champ = new ChampionDTO("nom", "bio", "icon");
- Assert.IsTrue(champ.equals((ChampionDTO)((CreatedAtActionResult)a).Value));
+ //Assert.AreEqual(champ,((CreatedAtActionResult)a).Value);
}
}
diff --git a/Sources/DTO/ChampionDTO.cs b/Sources/DTO/ChampionDTO.cs
index ddef07e..1e359a8 100644
--- a/Sources/DTO/ChampionDTO.cs
+++ b/Sources/DTO/ChampionDTO.cs
@@ -1,4 +1,5 @@
using Model;
+using System.Collections.Immutable;
namespace DTO
{
@@ -11,13 +12,25 @@ namespace DTO
Icon = icon;
}
+ //public ChampionDTO(string name, string bio, string icon, ICollection skills)
+ //{
+ // Name = name;
+ // Bio = bio;
+ // Icon = icon;
+ // Skills = skills;
+ //}
+
public string Name { get; set; }
public string Bio { get; set; }
//public ChampionClass Class { get; set; }
public string Icon { get; set; }
-
-
+ ///
+ /// pour plus tard ?
+ ///
+ //public ImmutableHashSet Skills { get; set; }
+
+ //public ICollection Skills { get; set; }
public bool equals(ChampionDTO other)
{
diff --git a/Sources/EntityFramework/ChampionEntity.cs b/Sources/EntityFramework/ChampionEntity.cs
index 2f859e1..f55a7f0 100644
--- a/Sources/EntityFramework/ChampionEntity.cs
+++ b/Sources/EntityFramework/ChampionEntity.cs
@@ -28,8 +28,10 @@ namespace EntityFramework
[Required]
public string Icon { get; set; }
- public ImmutableHashSet Skills => skills.ToImmutableHashSet();
- private HashSet skills = new HashSet();
+ //public ImmutableHashSet Skills => skills.ToImmutableHashSet();
+ //private HashSet skills = new HashSet();
+
+ private ICollection Skills { get; set; }
public ChampionEntity(string name,string bio,string icon) {
this.Name = name;
@@ -44,10 +46,10 @@ namespace EntityFramework
- public bool AddSkill(Skill skill)
- => skills.Add(skill);
+ public void AddSkill(Skill skill)
+ => this.Skills.Add(skill);
public bool RemoveSkill(Skill skill)
- => skills.Remove(skill);
+ => Skills.Remove(skill);
}
}
diff --git a/Sources/EntityFramework/Skill.cs b/Sources/EntityFramework/Skill.cs
index e9b1f32..bf9934e 100644
--- a/Sources/EntityFramework/Skill.cs
+++ b/Sources/EntityFramework/Skill.cs
@@ -1,15 +1,18 @@
using System;
using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EntityFramework
{
+
public class Skill
{
public SkillType Type { get; private set; }
-
+
+ [Key]
public string Name
{
get => name;
From eefe9f0abd675f0b96aa7d51594c037395d54943 Mon Sep 17 00:00:00 2001
From: Pierre Ferreira
Date: Wed, 1 Mar 2023 16:40:09 +0100
Subject: [PATCH 2/7] :card_file_box: Mise en BDD de l'attribut skill
---
Sources/DTO/ChampionDTO.cs | 3 +
Sources/EntityFramework/ChampionEntity.cs | 18 +++-
.../20230301152530_SkillMigration.Designer.cs | 85 ++++++++++++++++++
.../20230301152530_SkillMigration.cs | 63 +++++++++++++
.../Migrations/LoLDbContextModelSnapshot.cs | 82 +++++++++++++++++
Sources/EntityFramework/Program.cs | 16 ++++
.../{Skill.cs => SkillEntity.cs} | 8 +-
Sources/EntityFramework/champion.db | Bin 0 -> 32768 bytes
8 files changed, 271 insertions(+), 4 deletions(-)
create mode 100644 Sources/EntityFramework/Migrations/20230301152530_SkillMigration.Designer.cs
create mode 100644 Sources/EntityFramework/Migrations/20230301152530_SkillMigration.cs
create mode 100644 Sources/EntityFramework/Migrations/LoLDbContextModelSnapshot.cs
rename Sources/EntityFramework/{Skill.cs => SkillEntity.cs} (81%)
create mode 100644 Sources/EntityFramework/champion.db
diff --git a/Sources/DTO/ChampionDTO.cs b/Sources/DTO/ChampionDTO.cs
index 1e359a8..b56e6a1 100644
--- a/Sources/DTO/ChampionDTO.cs
+++ b/Sources/DTO/ChampionDTO.cs
@@ -25,12 +25,15 @@ namespace DTO
//public ChampionClass Class { get; set; }
public string Icon { get; set; }
+<<<<<<< Updated upstream
///
/// pour plus tard ?
///
//public ImmutableHashSet Skills { get; set; }
//public ICollection Skills { get; set; }
+=======
+>>>>>>> Stashed changes
public bool equals(ChampionDTO other)
{
diff --git a/Sources/EntityFramework/ChampionEntity.cs b/Sources/EntityFramework/ChampionEntity.cs
index f55a7f0..d2a59a0 100644
--- a/Sources/EntityFramework/ChampionEntity.cs
+++ b/Sources/EntityFramework/ChampionEntity.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
+using System.Collections.ObjectModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
@@ -31,12 +32,17 @@ namespace EntityFramework
//public ImmutableHashSet Skills => skills.ToImmutableHashSet();
//private HashSet skills = new HashSet();
- private ICollection Skills { get; set; }
+<<<<<<< Updated upstream
+ private ICollection Skills { get; set; }
+=======
+ public ICollection Skills { get; set; }
+>>>>>>> Stashed changes
public ChampionEntity(string name,string bio,string icon) {
this.Name = name;
this.Bio = bio;
this.Icon = icon;
+ Skills= new List();
}
public override string ToString()
@@ -46,10 +52,16 @@ namespace EntityFramework
- public void AddSkill(Skill skill)
+ public void AddSkill(SkillEntity skill)
+<<<<<<< Updated upstream
=> this.Skills.Add(skill);
- public bool RemoveSkill(Skill skill)
+ public bool RemoveSkill(SkillEntity skill)
+=======
+ => Skills.Add(skill);
+
+ public void RemoveSkill(Skill skill)
+>>>>>>> Stashed changes
=> Skills.Remove(skill);
}
}
diff --git a/Sources/EntityFramework/Migrations/20230301152530_SkillMigration.Designer.cs b/Sources/EntityFramework/Migrations/20230301152530_SkillMigration.Designer.cs
new file mode 100644
index 0000000..94bb55c
--- /dev/null
+++ b/Sources/EntityFramework/Migrations/20230301152530_SkillMigration.Designer.cs
@@ -0,0 +1,85 @@
+//
+using System;
+using EntityFramework;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+#nullable disable
+
+namespace EntityFramework.Migrations
+{
+ [DbContext(typeof(LoLDbContext))]
+ [Migration("20230301152530_SkillMigration")]
+ partial class SkillMigration
+ {
+ ///
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder.HasAnnotation("ProductVersion", "7.0.2");
+
+ modelBuilder.Entity("EntityFramework.ChampionEntity", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property("Bio")
+ .IsRequired()
+ .HasMaxLength(500)
+ .HasColumnType("string")
+ .HasColumnName("Bio");
+
+ b.Property("Icon")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasMaxLength(50)
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.ToTable("Champion", (string)null);
+ });
+
+ modelBuilder.Entity("EntityFramework.Skill", b =>
+ {
+ b.Property("Name")
+ .HasColumnType("TEXT");
+
+ b.Property("ChampionEntityId")
+ .HasColumnType("INTEGER");
+
+ b.Property("Description")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("Type")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Name");
+
+ b.HasIndex("ChampionEntityId");
+
+ b.ToTable("Skill");
+ });
+
+ modelBuilder.Entity("EntityFramework.Skill", b =>
+ {
+ b.HasOne("EntityFramework.ChampionEntity", null)
+ .WithMany("Skills")
+ .HasForeignKey("ChampionEntityId");
+ });
+
+ modelBuilder.Entity("EntityFramework.ChampionEntity", b =>
+ {
+ b.Navigation("Skills");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/Sources/EntityFramework/Migrations/20230301152530_SkillMigration.cs b/Sources/EntityFramework/Migrations/20230301152530_SkillMigration.cs
new file mode 100644
index 0000000..ce0154c
--- /dev/null
+++ b/Sources/EntityFramework/Migrations/20230301152530_SkillMigration.cs
@@ -0,0 +1,63 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace EntityFramework.Migrations
+{
+ ///
+ public partial class SkillMigration : Migration
+ {
+ ///
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.CreateTable(
+ name: "Champion",
+ columns: table => new
+ {
+ Id = table.Column(type: "INTEGER", nullable: false)
+ .Annotation("Sqlite:Autoincrement", true),
+ Name = table.Column(type: "TEXT", maxLength: 50, nullable: false),
+ Bio = table.Column(type: "string", maxLength: 500, nullable: false),
+ Icon = table.Column(type: "TEXT", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Champion", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "Skill",
+ columns: table => new
+ {
+ Name = table.Column(type: "TEXT", nullable: false),
+ Type = table.Column(type: "INTEGER", nullable: false),
+ Description = table.Column(type: "TEXT", nullable: false),
+ ChampionEntityId = table.Column(type: "INTEGER", nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Skill", x => x.Name);
+ table.ForeignKey(
+ name: "FK_Skill_Champion_ChampionEntityId",
+ column: x => x.ChampionEntityId,
+ principalTable: "Champion",
+ principalColumn: "Id");
+ });
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Skill_ChampionEntityId",
+ table: "Skill",
+ column: "ChampionEntityId");
+ }
+
+ ///
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropTable(
+ name: "Skill");
+
+ migrationBuilder.DropTable(
+ name: "Champion");
+ }
+ }
+}
diff --git a/Sources/EntityFramework/Migrations/LoLDbContextModelSnapshot.cs b/Sources/EntityFramework/Migrations/LoLDbContextModelSnapshot.cs
new file mode 100644
index 0000000..0abeee1
--- /dev/null
+++ b/Sources/EntityFramework/Migrations/LoLDbContextModelSnapshot.cs
@@ -0,0 +1,82 @@
+//
+using System;
+using EntityFramework;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+#nullable disable
+
+namespace EntityFramework.Migrations
+{
+ [DbContext(typeof(LoLDbContext))]
+ partial class LoLDbContextModelSnapshot : ModelSnapshot
+ {
+ protected override void BuildModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder.HasAnnotation("ProductVersion", "7.0.2");
+
+ modelBuilder.Entity("EntityFramework.ChampionEntity", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property("Bio")
+ .IsRequired()
+ .HasMaxLength(500)
+ .HasColumnType("string")
+ .HasColumnName("Bio");
+
+ b.Property("Icon")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasMaxLength(50)
+ .HasColumnType("TEXT");
+
+ b.HasKey("Id");
+
+ b.ToTable("Champion", (string)null);
+ });
+
+ modelBuilder.Entity("EntityFramework.Skill", b =>
+ {
+ b.Property("Name")
+ .HasColumnType("TEXT");
+
+ b.Property("ChampionEntityId")
+ .HasColumnType("INTEGER");
+
+ b.Property("Description")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("Type")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Name");
+
+ b.HasIndex("ChampionEntityId");
+
+ b.ToTable("Skill");
+ });
+
+ modelBuilder.Entity("EntityFramework.Skill", b =>
+ {
+ b.HasOne("EntityFramework.ChampionEntity", null)
+ .WithMany("Skills")
+ .HasForeignKey("ChampionEntityId");
+ });
+
+ modelBuilder.Entity("EntityFramework.ChampionEntity", b =>
+ {
+ b.Navigation("Skills");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/Sources/EntityFramework/Program.cs b/Sources/EntityFramework/Program.cs
index d3d785d..65ef614 100644
--- a/Sources/EntityFramework/Program.cs
+++ b/Sources/EntityFramework/Program.cs
@@ -18,4 +18,20 @@ using( var context = new LoLDbContext())
{
Console.WriteLine("Not Found");
}
+
+ //Test BDD Skills
+ ChampionEntity champSkill = new ChampionEntity("nomSkill", "bioSkill", "iconSkill");
+
+ SkillEntity s1 = new SkillEntity("Skill1", "desc", SkillType.Unknown);
+ SkillEntity s2 = new SkillEntity("Skill2", "desc2", SkillType.Ultimate);
+ SkillEntity s3 = new SkillEntity("Skill3", "desc3", SkillType.Passive);
+
+ champSkill.AddSkill(s1);
+ champSkill.AddSkill(s2);
+ champSkill.AddSkill(s3);
+
+ context.Add(champSkill);
+
+ context.SaveChanges();
+
}
diff --git a/Sources/EntityFramework/Skill.cs b/Sources/EntityFramework/SkillEntity.cs
similarity index 81%
rename from Sources/EntityFramework/Skill.cs
rename to Sources/EntityFramework/SkillEntity.cs
index bf9934e..d370410 100644
--- a/Sources/EntityFramework/Skill.cs
+++ b/Sources/EntityFramework/SkillEntity.cs
@@ -8,7 +8,7 @@ using System.Threading.Tasks;
namespace EntityFramework
{
- public class Skill
+ public class SkillEntity
{
public SkillType Type { get; private set; }
@@ -41,5 +41,11 @@ namespace EntityFramework
}
}
private string description = "";
+
+ public SkillEntity(string Name, string Description, SkillType Type) {
+ this.name = Name;
+ this.Description = Description;
+ this.Type = Type;
+ }
}
}
diff --git a/Sources/EntityFramework/champion.db b/Sources/EntityFramework/champion.db
new file mode 100644
index 0000000000000000000000000000000000000000..aa8a7ea4fee6e5913bc142265f1e4d4fa520e166
GIT binary patch
literal 32768
zcmeI)Z)?*)90%~b%i6AUHB%^|LiGp;mdWTJq>n`FOlxpUXB%aEAf;QQ2Df%L8Mud2
zUy4tC1wQwgPkg3N^tq@YD1uMCT$6U|y5YkOzDJW>E|<&Q=XVT}E^Xdha(#zC>h-tU
zJ};3u!Wg;9IU$6JWm+szni82{i4u)6$7~r{XkAFDe@NoYTXOb;`X==|^?Ej++7-J<
z5P$##AOHafKmY;|fWZF?c!`8|L!*0Hx7%@^o2#wnQ+IQ-wfLmHwe9x0M%Q=!U9%%g
zrxzPW#WuKU-8NRaeq?2x*DbEgQ*?esA8$*~y{N_#nx@fLPyP1#rXy?0RXn_cUAeVn
zjG9QzaFKMYz2)fKHdbwJ)x~muX^Ah^t)|_mn3m1;mAix9>wKkQE>{|B{I0QfH9Xng
z-4-W{dPdD?49|~_-gdl=zPs&aw4RGnAr4a2Ni
zK|d!#@rF?~8iuuKH2KgmFf}`RE;WbDr%u-3@1KH+CQjV+XHvMHH@zGjn@uNC2dGGXjdXQwLhv-}^8k
zVhkh0BjOn~b|9p@a^J3-mS}(3u-&0vV)_ZSVsgfBp9|CSR6aCk7#JZL|^ImIy)Qw
z1E=pDp3P!tCW~ti%SX+biPvcrCKfB=&y2jcPl*gwKN9glf&c^{009U<00Izz00bZa
z0SG|gv5P$##AOHafKmY;|fB*y_009V`
zSb_6OEJHOazvM5mj`&5)5KCfPs!u&06m
literal 0
HcmV?d00001
From 7182828a05af92318af2183d248db2447ae2318b Mon Sep 17 00:00:00 2001
From: Pierre Ferreira
Date: Wed, 1 Mar 2023 16:43:01 +0100
Subject: [PATCH 3/7] :card_file_box: Mise en BDD de l'attribut skill
---
Sources/DTO/ChampionDTO.cs | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/Sources/DTO/ChampionDTO.cs b/Sources/DTO/ChampionDTO.cs
index b56e6a1..922d56e 100644
--- a/Sources/DTO/ChampionDTO.cs
+++ b/Sources/DTO/ChampionDTO.cs
@@ -25,16 +25,6 @@ namespace DTO
//public ChampionClass Class { get; set; }
public string Icon { get; set; }
-<<<<<<< Updated upstream
- ///
- /// pour plus tard ?
- ///
- //public ImmutableHashSet Skills { get; set; }
-
- //public ICollection Skills { get; set; }
-=======
->>>>>>> Stashed changes
-
public bool equals(ChampionDTO other)
{
return other.Name==this.Name && other.Bio==this.Bio && other.Icon==this.Icon;
From 261801ed41ec42abbf13857f29af394882aebff8 Mon Sep 17 00:00:00 2001
From: Pierre Ferreira
Date: Wed, 1 Mar 2023 16:46:09 +0100
Subject: [PATCH 4/7] :card_file_box: Mise en BDD de l'attribut skill
---
Sources/EntityFramework/ChampionEntity.cs | 12 +-----------
Sources/EntityFramework/champion.db | Bin 32768 -> 32768 bytes
2 files changed, 1 insertion(+), 11 deletions(-)
diff --git a/Sources/EntityFramework/ChampionEntity.cs b/Sources/EntityFramework/ChampionEntity.cs
index d2a59a0..5d2c455 100644
--- a/Sources/EntityFramework/ChampionEntity.cs
+++ b/Sources/EntityFramework/ChampionEntity.cs
@@ -32,11 +32,7 @@ namespace EntityFramework
//public ImmutableHashSet Skills => skills.ToImmutableHashSet();
//private HashSet skills = new HashSet();
-<<<<<<< Updated upstream
private ICollection Skills { get; set; }
-=======
- public ICollection Skills { get; set; }
->>>>>>> Stashed changes
public ChampionEntity(string name,string bio,string icon) {
this.Name = name;
@@ -53,15 +49,9 @@ namespace EntityFramework
public void AddSkill(SkillEntity skill)
-<<<<<<< Updated upstream
- => this.Skills.Add(skill);
-
- public bool RemoveSkill(SkillEntity skill)
-=======
=> Skills.Add(skill);
- public void RemoveSkill(Skill skill)
->>>>>>> Stashed changes
+ public void RemoveSkill(SkillEntity skill)
=> Skills.Remove(skill);
}
}
diff --git a/Sources/EntityFramework/champion.db b/Sources/EntityFramework/champion.db
index aa8a7ea4fee6e5913bc142265f1e4d4fa520e166..662e97286ee8cfaef248c402272a5a70116a24d4 100644
GIT binary patch
delta 63
zcmZo@U}|V!+Q4GK!@@s{f&VT4S^i!8vo;F~bn!FEu}nU1FE7N*${;E#T9R5^0>hin
N+8YTlvMdTP002>e68-=H
delta 33
pcmZo@U}|V!+Q4GK!Nh--f&VT4+0B9i2l+RjwKo!AWLgwp006Ug3UL4c
From 797dc8abb7ec435b11d98500ee83741097a4cd82 Mon Sep 17 00:00:00 2001
From: Pierre Ferreira
Date: Wed, 1 Mar 2023 16:56:52 +0100
Subject: [PATCH 5/7] :zap: correction de bug de :bug:
---
Sources/API_LoL/Controllers/ChampionsController.cs | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/Sources/API_LoL/Controllers/ChampionsController.cs b/Sources/API_LoL/Controllers/ChampionsController.cs
index 25faddb..9aefc31 100644
--- a/Sources/API_LoL/Controllers/ChampionsController.cs
+++ b/Sources/API_LoL/Controllers/ChampionsController.cs
@@ -34,14 +34,14 @@ namespace API_LoL.Controllers
var list = await ChampionsManager.GetItemsByName(name, index,size);
if (list.Count() != 0)
{
- return Ok(list.Select(champion => champion?.toDTO()));
+ return Ok(list.Select(champion => champion?.ToDTO()));
}
else { return NoContent(); }
}else if(!string.IsNullOrEmpty(skill)) {
var list = await ChampionsManager.GetItemsBySkill(skill, index, size);
if (list.Count() != 0)
{
- return Ok(list.Select(champion => champion?.toDTO()));
+ return Ok(list.Select(champion => champion?.ToDTO()));
}
else { return NoContent(); }
}
@@ -49,7 +49,7 @@ namespace API_LoL.Controllers
var list = await ChampionsManager.GetItems(index, size);
if (list.Count() != 0)
{
- return Ok(list.Select(champion => champion?.toDTO()));
+ return Ok(list.Select(champion => champion?.ToDTO()));
}
else { return NoContent(); }
}
@@ -57,7 +57,7 @@ namespace API_LoL.Controllers
var list = await ChampionsManager.GetItems(index, size);
if (list.Count() != 0)
{
- return Ok(list.Select(champion => champion?.toDTO()));
+ return Ok(list.Select(champion => champion?.ToDTO()));
}
else { return NoContent(); }
}
From 4b5a6da084d02cfe31bc320ada36f5d16be2d06d Mon Sep 17 00:00:00 2001
From: Pierre Ferreira
Date: Wed, 1 Mar 2023 17:01:04 +0100
Subject: [PATCH 6/7] major changes :bug:
---
Sources/EntityFramework/ChampionEntity.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Sources/EntityFramework/ChampionEntity.cs b/Sources/EntityFramework/ChampionEntity.cs
index 5d2c455..75c3bf8 100644
--- a/Sources/EntityFramework/ChampionEntity.cs
+++ b/Sources/EntityFramework/ChampionEntity.cs
@@ -32,7 +32,7 @@ namespace EntityFramework
//public ImmutableHashSet Skills => skills.ToImmutableHashSet();
//private HashSet skills = new HashSet();
- private ICollection Skills { get; set; }
+ private ICollection Skills { get; set; }
public ChampionEntity(string name,string bio,string icon) {
this.Name = name;
From b0db9958ffb7ae9a647787d033e3970472ac107a Mon Sep 17 00:00:00 2001
From: Pierre Ferreira
Date: Wed, 1 Mar 2023 17:05:00 +0100
Subject: [PATCH 7/7] major changes :bug:
---
Sources/EntityFramework/ChampionEntity.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Sources/EntityFramework/ChampionEntity.cs b/Sources/EntityFramework/ChampionEntity.cs
index 75c3bf8..5d2c455 100644
--- a/Sources/EntityFramework/ChampionEntity.cs
+++ b/Sources/EntityFramework/ChampionEntity.cs
@@ -32,7 +32,7 @@ namespace EntityFramework
//public ImmutableHashSet Skills => skills.ToImmutableHashSet();
//private HashSet skills = new HashSet();
- private ICollection Skills { get; set; }
+ private ICollection Skills { get; set; }
public ChampionEntity(string name,string bio,string icon) {
this.Name = name;