Merge pull request 'SES-152 Endpoint zwracający sklepikarzy' (#79) from SES-152 into dev
Reviewed-on: #79
This commit is contained in:
commit
3466b54785
@ -42,6 +42,8 @@ namespace SessionCompanion.Database
|
|||||||
public virtual DbSet<GameAction> GameActions { get; set; }
|
public virtual DbSet<GameAction> GameActions { get; set; }
|
||||||
public virtual DbSet<LegendaryAction> LegendaryActions { get; set; }
|
public virtual DbSet<LegendaryAction> LegendaryActions { get; set; }
|
||||||
public virtual DbSet<SpecialAbility> SpecialAbilities { get; set; }
|
public virtual DbSet<SpecialAbility> SpecialAbilities { get; set; }
|
||||||
|
public virtual DbSet<Shopkeeper> Shopkeepers { get; set; }
|
||||||
|
public virtual DbSet<ShopkeeperItem> ShopkeeperItems { get; set; }
|
||||||
|
|
||||||
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options) : base(options) { }
|
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options) : base(options) { }
|
||||||
|
|
||||||
@ -136,7 +138,6 @@ namespace SessionCompanion.Database
|
|||||||
SpecialAbilitiesList = specAbilities;
|
SpecialAbilitiesList = specAbilities;
|
||||||
return specAbilities;
|
return specAbilities;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IEnumerable<GameAction> SeedActions()
|
protected IEnumerable<GameAction> SeedActions()
|
||||||
{
|
{
|
||||||
const string file = "../SessionCompanion.Database/JsonData/monsters.json";
|
const string file = "../SessionCompanion.Database/JsonData/monsters.json";
|
||||||
@ -164,7 +165,6 @@ namespace SessionCompanion.Database
|
|||||||
GameActionsList = gameActions;
|
GameActionsList = gameActions;
|
||||||
return gameActions;
|
return gameActions;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IEnumerable<LegendaryAction> SeedLegendaryActions()
|
protected IEnumerable<LegendaryAction> SeedLegendaryActions()
|
||||||
{
|
{
|
||||||
const string file = "../SessionCompanion.Database/JsonData/monsters.json";
|
const string file = "../SessionCompanion.Database/JsonData/monsters.json";
|
||||||
@ -192,7 +192,6 @@ namespace SessionCompanion.Database
|
|||||||
LegendaryActionsList = legendaryActions;
|
LegendaryActionsList = legendaryActions;
|
||||||
return legendaryActions;
|
return legendaryActions;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IEnumerable<Monster> SeedMonster()
|
protected IEnumerable<Monster> SeedMonster()
|
||||||
{
|
{
|
||||||
const string file = "../SessionCompanion.Database/JsonData/monsters.json";
|
const string file = "../SessionCompanion.Database/JsonData/monsters.json";
|
||||||
@ -206,7 +205,6 @@ namespace SessionCompanion.Database
|
|||||||
}
|
}
|
||||||
return monsters;
|
return monsters;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IEnumerable<MonsterSpecialAbility> SeedMonsterSpecialAbilities()
|
protected IEnumerable<MonsterSpecialAbility> SeedMonsterSpecialAbilities()
|
||||||
{
|
{
|
||||||
const string file = "../SessionCompanion.Database/JsonData/monsters.json";
|
const string file = "../SessionCompanion.Database/JsonData/monsters.json";
|
||||||
@ -231,7 +229,6 @@ namespace SessionCompanion.Database
|
|||||||
}
|
}
|
||||||
return monsterSpecialAbilities;
|
return monsterSpecialAbilities;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IEnumerable<MonsterAction> SeedMonsterActions()
|
protected IEnumerable<MonsterAction> SeedMonsterActions()
|
||||||
{
|
{
|
||||||
const string file = "../SessionCompanion.Database/JsonData/monsters.json";
|
const string file = "../SessionCompanion.Database/JsonData/monsters.json";
|
||||||
@ -256,7 +253,6 @@ namespace SessionCompanion.Database
|
|||||||
}
|
}
|
||||||
return monsterActions;
|
return monsterActions;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IEnumerable<MonsterLegendaryAction> SeedMonsterLegendaryActions()
|
protected IEnumerable<MonsterLegendaryAction> SeedMonsterLegendaryActions()
|
||||||
{
|
{
|
||||||
const string file = "../SessionCompanion.Database/JsonData/monsters.json";
|
const string file = "../SessionCompanion.Database/JsonData/monsters.json";
|
||||||
@ -314,6 +310,8 @@ namespace SessionCompanion.Database
|
|||||||
builder.Entity<MonsterSpecialAbility>().HasData(SeedMonsterSpecialAbilities());
|
builder.Entity<MonsterSpecialAbility>().HasData(SeedMonsterSpecialAbilities());
|
||||||
builder.Entity<MonsterAction>().HasData(SeedMonsterActions());
|
builder.Entity<MonsterAction>().HasData(SeedMonsterActions());
|
||||||
builder.Entity<MonsterLegendaryAction>().HasData(SeedMonsterLegendaryActions());
|
builder.Entity<MonsterLegendaryAction>().HasData(SeedMonsterLegendaryActions());
|
||||||
|
builder.Entity<Shopkeeper>().HasData(SeedData.SeedSchopkeepers());
|
||||||
|
builder.Entity<ShopkeeperItem>().HasData(SeedData.SeedShopkeeperItems());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
29294
SessionCompanion/SessionCompanion.Database/Migrations/20210120170646_shopkepe.Designer.cs
generated
Normal file
29294
SessionCompanion/SessionCompanion.Database/Migrations/20210120170646_shopkepe.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,123 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Database.Migrations
|
||||||
|
{
|
||||||
|
public partial class shopkepe : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Shopkeepers",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
Name = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||||
|
IsAvailable = table.Column<bool>(type: "bit", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Shopkeepers", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "ShopkeeperItems",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
ShopkeeperId = table.Column<int>(type: "int", nullable: false),
|
||||||
|
ArmorId = table.Column<int>(type: "int", nullable: true),
|
||||||
|
WeaponId = table.Column<int>(type: "int", nullable: true)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_ShopkeeperItems", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_ShopkeeperItems_Armors_ArmorId",
|
||||||
|
column: x => x.ArmorId,
|
||||||
|
principalTable: "Armors",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_ShopkeeperItems_Shopkeepers_ShopkeeperId",
|
||||||
|
column: x => x.ShopkeeperId,
|
||||||
|
principalTable: "Shopkeepers",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_ShopkeeperItems_Weapons_WeaponId",
|
||||||
|
column: x => x.WeaponId,
|
||||||
|
principalTable: "Weapons",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.InsertData(
|
||||||
|
table: "Shopkeepers",
|
||||||
|
columns: new[] { "Id", "IsAvailable", "Name" },
|
||||||
|
values: new object[,]
|
||||||
|
{
|
||||||
|
{ 1, true, "Swędzioch" },
|
||||||
|
{ 2, false, "Lucius Prawowity" },
|
||||||
|
{ 3, true, "Bohr Twarda Zbroja" },
|
||||||
|
{ 4, false, "Skwarczyk Podobny" },
|
||||||
|
{ 5, true, "Zielony spod Gruszkowego Lasu" },
|
||||||
|
{ 6, false, "Zmarniały" }
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.InsertData(
|
||||||
|
table: "ShopkeeperItems",
|
||||||
|
columns: new[] { "Id", "ArmorId", "ShopkeeperId", "WeaponId" },
|
||||||
|
values: new object[,]
|
||||||
|
{
|
||||||
|
{ 1, 2, 1, null },
|
||||||
|
{ 20, 13, 6, null },
|
||||||
|
{ 19, 2, 6, null },
|
||||||
|
{ 18, 7, 5, null },
|
||||||
|
{ 17, 9, 5, null },
|
||||||
|
{ 16, 6, 5, null },
|
||||||
|
{ 15, 11, 4, null },
|
||||||
|
{ 14, null, 4, 14 },
|
||||||
|
{ 13, null, 4, 24 },
|
||||||
|
{ 12, null, 4, 1 },
|
||||||
|
{ 11, null, 3, 7 },
|
||||||
|
{ 10, 8, 3, null },
|
||||||
|
{ 9, 1, 3, null },
|
||||||
|
{ 8, null, 2, 14 },
|
||||||
|
{ 7, null, 2, 25 },
|
||||||
|
{ 6, null, 2, 3 },
|
||||||
|
{ 5, 12, 1, null },
|
||||||
|
{ 4, null, 1, 17 },
|
||||||
|
{ 3, 10, 1, null },
|
||||||
|
{ 2, null, 1, 33 },
|
||||||
|
{ 21, 10, 6, null },
|
||||||
|
{ 22, null, 6, 37 }
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_ShopkeeperItems_ArmorId",
|
||||||
|
table: "ShopkeeperItems",
|
||||||
|
column: "ArmorId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_ShopkeeperItems_ShopkeeperId",
|
||||||
|
table: "ShopkeeperItems",
|
||||||
|
column: "ShopkeeperId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_ShopkeeperItems_WeaponId",
|
||||||
|
table: "ShopkeeperItems",
|
||||||
|
column: "WeaponId");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "ShopkeeperItems");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Shopkeepers");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
29319
SessionCompanion/SessionCompanion.Database/Migrations/20210120173104_shopkeepers-items.Designer.cs
generated
Normal file
29319
SessionCompanion/SessionCompanion.Database/Migrations/20210120173104_shopkeepers-items.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,178 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Database.Migrations
|
||||||
|
{
|
||||||
|
public partial class shopkeepersitems : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<int>(
|
||||||
|
name: "Amount",
|
||||||
|
table: "ShopkeeperItems",
|
||||||
|
type: "int",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0);
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "ShopkeeperItems",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: 1,
|
||||||
|
column: "Amount",
|
||||||
|
value: 3);
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "ShopkeeperItems",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: 2,
|
||||||
|
column: "Amount",
|
||||||
|
value: 5);
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "ShopkeeperItems",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: 3,
|
||||||
|
column: "Amount",
|
||||||
|
value: 20);
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "ShopkeeperItems",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: 4,
|
||||||
|
column: "Amount",
|
||||||
|
value: 34);
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "ShopkeeperItems",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: 5,
|
||||||
|
column: "Amount",
|
||||||
|
value: 12);
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "ShopkeeperItems",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: 6,
|
||||||
|
column: "Amount",
|
||||||
|
value: 48);
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "ShopkeeperItems",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: 7,
|
||||||
|
column: "Amount",
|
||||||
|
value: 25);
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "ShopkeeperItems",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: 8,
|
||||||
|
column: "Amount",
|
||||||
|
value: 34);
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "ShopkeeperItems",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: 9,
|
||||||
|
column: "Amount",
|
||||||
|
value: 44);
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "ShopkeeperItems",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: 10,
|
||||||
|
column: "Amount",
|
||||||
|
value: 2);
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "ShopkeeperItems",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: 11,
|
||||||
|
column: "Amount",
|
||||||
|
value: 21);
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "ShopkeeperItems",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: 12,
|
||||||
|
column: "Amount",
|
||||||
|
value: 36);
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "ShopkeeperItems",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: 13,
|
||||||
|
column: "Amount",
|
||||||
|
value: 5);
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "ShopkeeperItems",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: 14,
|
||||||
|
column: "Amount",
|
||||||
|
value: 13);
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "ShopkeeperItems",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: 15,
|
||||||
|
column: "Amount",
|
||||||
|
value: 19);
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "ShopkeeperItems",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: 16,
|
||||||
|
column: "Amount",
|
||||||
|
value: 17);
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "ShopkeeperItems",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: 17,
|
||||||
|
column: "Amount",
|
||||||
|
value: 3);
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "ShopkeeperItems",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: 18,
|
||||||
|
column: "Amount",
|
||||||
|
value: 1);
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "ShopkeeperItems",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: 19,
|
||||||
|
column: "Amount",
|
||||||
|
value: 6);
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "ShopkeeperItems",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: 20,
|
||||||
|
column: "Amount",
|
||||||
|
value: 9);
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "ShopkeeperItems",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: 21,
|
||||||
|
column: "Amount",
|
||||||
|
value: 12);
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "ShopkeeperItems",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: 22,
|
||||||
|
column: "Amount",
|
||||||
|
value: 6);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Amount",
|
||||||
|
table: "ShopkeeperItems");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -21521,6 +21521,248 @@ namespace SessionCompanion.Database.Migrations
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Shopkeeper", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.UseIdentityColumn();
|
||||||
|
|
||||||
|
b.Property<bool>("IsAvailable")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Shopkeepers");
|
||||||
|
|
||||||
|
b.HasData(
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 1,
|
||||||
|
IsAvailable = true,
|
||||||
|
Name = "Swędzioch"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 2,
|
||||||
|
IsAvailable = false,
|
||||||
|
Name = "Lucius Prawowity"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 3,
|
||||||
|
IsAvailable = true,
|
||||||
|
Name = "Bohr Twarda Zbroja"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 4,
|
||||||
|
IsAvailable = false,
|
||||||
|
Name = "Skwarczyk Podobny"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 5,
|
||||||
|
IsAvailable = true,
|
||||||
|
Name = "Zielony spod Gruszkowego Lasu"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 6,
|
||||||
|
IsAvailable = false,
|
||||||
|
Name = "Zmarniały"
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.ShopkeeperItem", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int")
|
||||||
|
.UseIdentityColumn();
|
||||||
|
|
||||||
|
b.Property<int>("Amount")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int?>("ArmorId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("ShopkeeperId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int?>("WeaponId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ArmorId");
|
||||||
|
|
||||||
|
b.HasIndex("ShopkeeperId");
|
||||||
|
|
||||||
|
b.HasIndex("WeaponId");
|
||||||
|
|
||||||
|
b.ToTable("ShopkeeperItems");
|
||||||
|
|
||||||
|
b.HasData(
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 1,
|
||||||
|
Amount = 3,
|
||||||
|
ArmorId = 2,
|
||||||
|
ShopkeeperId = 1
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 2,
|
||||||
|
Amount = 5,
|
||||||
|
ShopkeeperId = 1,
|
||||||
|
WeaponId = 33
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 3,
|
||||||
|
Amount = 20,
|
||||||
|
ArmorId = 10,
|
||||||
|
ShopkeeperId = 1
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 4,
|
||||||
|
Amount = 34,
|
||||||
|
ShopkeeperId = 1,
|
||||||
|
WeaponId = 17
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 5,
|
||||||
|
Amount = 12,
|
||||||
|
ArmorId = 12,
|
||||||
|
ShopkeeperId = 1
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 6,
|
||||||
|
Amount = 48,
|
||||||
|
ShopkeeperId = 2,
|
||||||
|
WeaponId = 3
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 7,
|
||||||
|
Amount = 25,
|
||||||
|
ShopkeeperId = 2,
|
||||||
|
WeaponId = 25
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 8,
|
||||||
|
Amount = 34,
|
||||||
|
ShopkeeperId = 2,
|
||||||
|
WeaponId = 14
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 9,
|
||||||
|
Amount = 44,
|
||||||
|
ArmorId = 1,
|
||||||
|
ShopkeeperId = 3
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 10,
|
||||||
|
Amount = 2,
|
||||||
|
ArmorId = 8,
|
||||||
|
ShopkeeperId = 3
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 11,
|
||||||
|
Amount = 21,
|
||||||
|
ShopkeeperId = 3,
|
||||||
|
WeaponId = 7
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 12,
|
||||||
|
Amount = 36,
|
||||||
|
ShopkeeperId = 4,
|
||||||
|
WeaponId = 1
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 13,
|
||||||
|
Amount = 5,
|
||||||
|
ShopkeeperId = 4,
|
||||||
|
WeaponId = 24
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 14,
|
||||||
|
Amount = 13,
|
||||||
|
ShopkeeperId = 4,
|
||||||
|
WeaponId = 14
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 15,
|
||||||
|
Amount = 19,
|
||||||
|
ArmorId = 11,
|
||||||
|
ShopkeeperId = 4
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 16,
|
||||||
|
Amount = 17,
|
||||||
|
ArmorId = 6,
|
||||||
|
ShopkeeperId = 5
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 17,
|
||||||
|
Amount = 3,
|
||||||
|
ArmorId = 9,
|
||||||
|
ShopkeeperId = 5
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 18,
|
||||||
|
Amount = 1,
|
||||||
|
ArmorId = 7,
|
||||||
|
ShopkeeperId = 5
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 19,
|
||||||
|
Amount = 6,
|
||||||
|
ArmorId = 2,
|
||||||
|
ShopkeeperId = 6
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 20,
|
||||||
|
Amount = 9,
|
||||||
|
ArmorId = 13,
|
||||||
|
ShopkeeperId = 6
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 21,
|
||||||
|
Amount = 12,
|
||||||
|
ArmorId = 10,
|
||||||
|
ShopkeeperId = 6
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 22,
|
||||||
|
Amount = 6,
|
||||||
|
ShopkeeperId = 6,
|
||||||
|
WeaponId = 37
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("SessionCompanion.Database.Tables.SpecialAbility", b =>
|
modelBuilder.Entity("SessionCompanion.Database.Tables.SpecialAbility", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
@ -28921,6 +29163,29 @@ namespace SessionCompanion.Database.Migrations
|
|||||||
b.Navigation("SpecialAbility");
|
b.Navigation("SpecialAbility");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.ShopkeeperItem", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("SessionCompanion.Database.Tables.Armor", "Armor")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ArmorId");
|
||||||
|
|
||||||
|
b.HasOne("SessionCompanion.Database.Tables.Shopkeeper", "Shopkeeper")
|
||||||
|
.WithMany("ShopkeeperItems")
|
||||||
|
.HasForeignKey("ShopkeeperId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("SessionCompanion.Database.Tables.Weapon", "Weapon")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("WeaponId");
|
||||||
|
|
||||||
|
b.Navigation("Armor");
|
||||||
|
|
||||||
|
b.Navigation("Shopkeeper");
|
||||||
|
|
||||||
|
b.Navigation("Weapon");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("SessionCompanion.Database.Tables.Statistics", b =>
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Statistics", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("SessionCompanion.Database.Tables.Character", "Character")
|
b.HasOne("SessionCompanion.Database.Tables.Character", "Character")
|
||||||
@ -29022,6 +29287,11 @@ namespace SessionCompanion.Database.Migrations
|
|||||||
b.Navigation("Biography");
|
b.Navigation("Biography");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("SessionCompanion.Database.Tables.Shopkeeper", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("ShopkeeperItems");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("SessionCompanion.Database.Tables.SpecialAbility", b =>
|
modelBuilder.Entity("SessionCompanion.Database.Tables.SpecialAbility", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("MonsterSpecialAbilities");
|
b.Navigation("MonsterSpecialAbilities");
|
||||||
|
@ -0,0 +1,16 @@
|
|||||||
|
using SessionCompanion.Database.Repositories.Base;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Database.Repositories
|
||||||
|
{
|
||||||
|
public class ShopkeeperItemRepository : Repository<ShopkeeperItem>, IRepository<ShopkeeperItem>
|
||||||
|
{
|
||||||
|
public ShopkeeperItemRepository(ApplicationDbContext _dbContext) : base(_dbContext)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
using SessionCompanion.Database.Repositories.Base;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Database.Repositories
|
||||||
|
{
|
||||||
|
public class ShopkeeperRepository : Repository<Shopkeeper>, IRepository<Shopkeeper>
|
||||||
|
{
|
||||||
|
public ShopkeeperRepository(ApplicationDbContext _dbContext) : base(_dbContext)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
@ -843,5 +843,209 @@ namespace SessionCompanion.Database
|
|||||||
};
|
};
|
||||||
return characterSpellSlots;
|
return characterSpellSlots;
|
||||||
}
|
}
|
||||||
|
static public List<Shopkeeper> SeedSchopkeepers()
|
||||||
|
{
|
||||||
|
List<Shopkeeper> shopkeepers = new List<Shopkeeper>()
|
||||||
|
{
|
||||||
|
new Shopkeeper
|
||||||
|
{
|
||||||
|
Id = 1,
|
||||||
|
Name = "Swędzioch",
|
||||||
|
IsAvailable = true
|
||||||
|
},
|
||||||
|
new Shopkeeper
|
||||||
|
{
|
||||||
|
Id = 2,
|
||||||
|
Name = "Lucius Prawowity",
|
||||||
|
IsAvailable = false
|
||||||
|
},
|
||||||
|
new Shopkeeper
|
||||||
|
{
|
||||||
|
Id = 3,
|
||||||
|
Name = "Bohr Twarda Zbroja",
|
||||||
|
IsAvailable = true
|
||||||
|
},
|
||||||
|
new Shopkeeper
|
||||||
|
{
|
||||||
|
Id = 4,
|
||||||
|
Name = "Skwarczyk Podobny",
|
||||||
|
IsAvailable = false
|
||||||
|
},
|
||||||
|
new Shopkeeper
|
||||||
|
{
|
||||||
|
Id = 5,
|
||||||
|
Name = "Zielony spod Gruszkowego Lasu",
|
||||||
|
IsAvailable = true
|
||||||
|
},
|
||||||
|
new Shopkeeper
|
||||||
|
{
|
||||||
|
Id = 6,
|
||||||
|
Name = "Zmarniały",
|
||||||
|
IsAvailable = false
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return shopkeepers;
|
||||||
|
}
|
||||||
|
static public List<ShopkeeperItem> SeedShopkeeperItems()
|
||||||
|
{
|
||||||
|
List<ShopkeeperItem> shopkeeperItems = new List<ShopkeeperItem>()
|
||||||
|
{
|
||||||
|
new ShopkeeperItem
|
||||||
|
{
|
||||||
|
Id = 1,
|
||||||
|
ShopkeeperId = 1,
|
||||||
|
ArmorId = 2,
|
||||||
|
Amount = 3
|
||||||
|
},
|
||||||
|
new ShopkeeperItem
|
||||||
|
{
|
||||||
|
Id = 2,
|
||||||
|
ShopkeeperId = 1,
|
||||||
|
WeaponId = 33,
|
||||||
|
Amount = 5
|
||||||
|
},
|
||||||
|
new ShopkeeperItem
|
||||||
|
{
|
||||||
|
Id = 3,
|
||||||
|
ShopkeeperId = 1,
|
||||||
|
ArmorId = 10,
|
||||||
|
Amount = 20
|
||||||
|
},
|
||||||
|
new ShopkeeperItem
|
||||||
|
{
|
||||||
|
Id = 4,
|
||||||
|
ShopkeeperId = 1,
|
||||||
|
WeaponId = 17,
|
||||||
|
Amount = 34
|
||||||
|
},
|
||||||
|
new ShopkeeperItem
|
||||||
|
{
|
||||||
|
Id = 5,
|
||||||
|
ShopkeeperId = 1,
|
||||||
|
ArmorId = 12,
|
||||||
|
Amount = 12
|
||||||
|
},
|
||||||
|
new ShopkeeperItem
|
||||||
|
{
|
||||||
|
Id = 6,
|
||||||
|
ShopkeeperId = 2,
|
||||||
|
WeaponId = 3,
|
||||||
|
Amount = 48
|
||||||
|
},
|
||||||
|
new ShopkeeperItem
|
||||||
|
{
|
||||||
|
Id = 7,
|
||||||
|
ShopkeeperId = 2,
|
||||||
|
WeaponId = 25,
|
||||||
|
Amount = 25
|
||||||
|
},
|
||||||
|
new ShopkeeperItem
|
||||||
|
{
|
||||||
|
Id = 8,
|
||||||
|
ShopkeeperId = 2,
|
||||||
|
WeaponId = 14,
|
||||||
|
Amount = 34
|
||||||
|
},
|
||||||
|
new ShopkeeperItem
|
||||||
|
{
|
||||||
|
Id = 9,
|
||||||
|
ShopkeeperId = 3,
|
||||||
|
ArmorId = 1,
|
||||||
|
Amount = 44
|
||||||
|
},
|
||||||
|
new ShopkeeperItem
|
||||||
|
{
|
||||||
|
Id = 10,
|
||||||
|
ShopkeeperId = 3,
|
||||||
|
ArmorId = 8,
|
||||||
|
Amount = 2
|
||||||
|
},
|
||||||
|
new ShopkeeperItem
|
||||||
|
{
|
||||||
|
Id = 11,
|
||||||
|
ShopkeeperId = 3,
|
||||||
|
WeaponId = 7,
|
||||||
|
Amount = 21
|
||||||
|
},
|
||||||
|
new ShopkeeperItem
|
||||||
|
{
|
||||||
|
Id = 12,
|
||||||
|
ShopkeeperId = 4,
|
||||||
|
WeaponId = 1,
|
||||||
|
Amount = 36
|
||||||
|
},
|
||||||
|
new ShopkeeperItem
|
||||||
|
{
|
||||||
|
Id = 13,
|
||||||
|
ShopkeeperId = 4,
|
||||||
|
WeaponId = 24,
|
||||||
|
Amount = 5
|
||||||
|
},
|
||||||
|
new ShopkeeperItem
|
||||||
|
{
|
||||||
|
Id = 14,
|
||||||
|
ShopkeeperId = 4,
|
||||||
|
WeaponId = 14,
|
||||||
|
Amount = 13
|
||||||
|
},
|
||||||
|
new ShopkeeperItem
|
||||||
|
{
|
||||||
|
Id = 15,
|
||||||
|
ShopkeeperId = 4,
|
||||||
|
ArmorId = 11,
|
||||||
|
Amount = 19
|
||||||
|
},
|
||||||
|
new ShopkeeperItem
|
||||||
|
{
|
||||||
|
Id = 16,
|
||||||
|
ShopkeeperId = 5,
|
||||||
|
ArmorId = 6,
|
||||||
|
Amount = 17
|
||||||
|
},
|
||||||
|
new ShopkeeperItem
|
||||||
|
{
|
||||||
|
Id = 17,
|
||||||
|
ShopkeeperId = 5,
|
||||||
|
ArmorId = 9,
|
||||||
|
Amount = 3
|
||||||
|
},
|
||||||
|
new ShopkeeperItem
|
||||||
|
{
|
||||||
|
Id = 18,
|
||||||
|
ShopkeeperId = 5,
|
||||||
|
ArmorId = 7,
|
||||||
|
Amount = 1
|
||||||
|
},
|
||||||
|
new ShopkeeperItem
|
||||||
|
{
|
||||||
|
Id = 19,
|
||||||
|
ShopkeeperId = 6,
|
||||||
|
ArmorId = 2,
|
||||||
|
Amount = 6
|
||||||
|
},
|
||||||
|
new ShopkeeperItem
|
||||||
|
{
|
||||||
|
Id = 20,
|
||||||
|
ShopkeeperId = 6,
|
||||||
|
ArmorId = 13,
|
||||||
|
Amount = 9
|
||||||
|
},
|
||||||
|
new ShopkeeperItem
|
||||||
|
{
|
||||||
|
Id = 21,
|
||||||
|
ShopkeeperId = 6,
|
||||||
|
ArmorId = 10,
|
||||||
|
Amount = 12
|
||||||
|
},
|
||||||
|
new ShopkeeperItem
|
||||||
|
{
|
||||||
|
Id = 22,
|
||||||
|
ShopkeeperId = 6,
|
||||||
|
WeaponId = 37,
|
||||||
|
Amount = 6
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return shopkeeperItems;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,17 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Database.Tables
|
||||||
|
{
|
||||||
|
public class Shopkeeper : BaseEntity
|
||||||
|
{
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
public bool IsAvailable { get; set; }
|
||||||
|
|
||||||
|
public virtual ICollection<ShopkeeperItem> ShopkeeperItems { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,26 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Database.Tables
|
||||||
|
{
|
||||||
|
public class ShopkeeperItem : BaseEntity
|
||||||
|
{
|
||||||
|
[ForeignKey(nameof(Shopkeeper))]
|
||||||
|
public int ShopkeeperId { get; set; }
|
||||||
|
public virtual Shopkeeper Shopkeeper { get; set; }
|
||||||
|
|
||||||
|
[ForeignKey(nameof(Armor))]
|
||||||
|
public int? ArmorId { get; set; }
|
||||||
|
public virtual Armor Armor { get; set; }
|
||||||
|
|
||||||
|
[ForeignKey(nameof(Weapon))]
|
||||||
|
public int? WeaponId { get; set; }
|
||||||
|
public virtual Weapon Weapon { get; set; }
|
||||||
|
|
||||||
|
public int Amount { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.ViewModels.ShopkeeperItemsViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Interfaces
|
||||||
|
{
|
||||||
|
public interface IShopkeeperItemService : IServiceBase<ShopkeeperItemViewModel, ShopkeeperItem>
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.ViewModels.ShopkeeperViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Interfaces
|
||||||
|
{
|
||||||
|
public interface IShopkeeperService : IServiceBase<ShopkeeperViewModel, Shopkeeper>
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.ViewModels.ShopkeeperItemsViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Profiles
|
||||||
|
{
|
||||||
|
public class ShopkeeperItemsProfile : Profile
|
||||||
|
{
|
||||||
|
public ShopkeeperItemsProfile()
|
||||||
|
{
|
||||||
|
CreateMap<ShopkeeperItemViewModel, ShopkeeperItem>().ReverseMap();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.ViewModels.ShopkeeperViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Profiles
|
||||||
|
{
|
||||||
|
public class ShopkeeperProfile : Profile
|
||||||
|
{
|
||||||
|
public ShopkeeperProfile()
|
||||||
|
{
|
||||||
|
CreateMap<ShopkeeperViewModel, Shopkeeper>().ReverseMap();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using SessionCompanion.Database.Repositories.Base;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.Services.Interfaces;
|
||||||
|
using SessionCompanion.ViewModels.ShopkeeperItemsViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Services
|
||||||
|
{
|
||||||
|
public class ShopkeeperItemService : ServiceBase<ShopkeeperItemViewModel, ShopkeeperItem>, IShopkeeperItemService
|
||||||
|
{
|
||||||
|
public ShopkeeperItemService(IMapper mapper, IRepository<ShopkeeperItem> repository) : base(mapper, repository)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using SessionCompanion.Database.Repositories.Base;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.Services.Interfaces;
|
||||||
|
using SessionCompanion.ViewModels.ShopkeeperViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Services
|
||||||
|
{
|
||||||
|
public class ShopkeeperService : ServiceBase<ShopkeeperViewModel, Shopkeeper>, IShopkeeperService
|
||||||
|
{
|
||||||
|
public ShopkeeperService(IMapper mapper, IRepository<Shopkeeper> repository) : base(mapper, repository)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SessionCompanion.ViewModels.ShopkeeperItemsViewModels
|
||||||
|
{
|
||||||
|
public class ShopkeeperItemViewModel
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Id Sprzedawcy
|
||||||
|
/// </summary>
|
||||||
|
public int ShopkeeperId { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Id zbroi
|
||||||
|
/// </summary>
|
||||||
|
public int? ArmorId { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Id broni
|
||||||
|
/// </summary>
|
||||||
|
public int? WeaponId { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SessionCompanion.ViewModels.ShopkeeperViewModels
|
||||||
|
{
|
||||||
|
public class ShopkeeperViewModel
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Id sprzedawcy
|
||||||
|
/// </summary>
|
||||||
|
public int Id { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Imie sprzedawcy
|
||||||
|
/// </summary>
|
||||||
|
public string Name { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Dostępność sprzedawcy
|
||||||
|
/// </summary>
|
||||||
|
public bool IsAvailable { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -43,6 +43,8 @@ namespace SessionCompanion.Configurations
|
|||||||
services.AddScoped<IRepository<Monster>, MonsterRepository>();
|
services.AddScoped<IRepository<Monster>, MonsterRepository>();
|
||||||
services.AddScoped<IRepository<MonsterSpecialAbility>, MonsterSpecialAbilitiesRepository>();
|
services.AddScoped<IRepository<MonsterSpecialAbility>, MonsterSpecialAbilitiesRepository>();
|
||||||
services.AddScoped<IRepository<SpecialAbility>, SpecialAbilityRepository>();
|
services.AddScoped<IRepository<SpecialAbility>, SpecialAbilityRepository>();
|
||||||
|
services.AddScoped<IRepository<Shopkeeper>, ShopkeeperRepository>();
|
||||||
|
services.AddScoped<IRepository<ShopkeeperItem>, ShopkeeperItemRepository>();
|
||||||
return services;
|
return services;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,8 @@ namespace SessionCompanion.Configurations
|
|||||||
services.AddScoped<IWeaponService, WeaponService>();
|
services.AddScoped<IWeaponService, WeaponService>();
|
||||||
services.AddScoped<ICharacterWeaponService, CharacterWeaponService>();
|
services.AddScoped<ICharacterWeaponService, CharacterWeaponService>();
|
||||||
services.AddScoped<IMonsterService, MonsterService>();
|
services.AddScoped<IMonsterService, MonsterService>();
|
||||||
|
services.AddScoped<IShopkeeperService, ShopkeeperService>();
|
||||||
|
services.AddScoped<IShopkeeperItemService, ShopkeeperItemService>();
|
||||||
|
|
||||||
return services;
|
return services;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using SessionCompanion.Extensions.EitherType;
|
||||||
|
using SessionCompanion.Services.Interfaces;
|
||||||
|
using SessionCompanion.ViewModels.ApiResponses;
|
||||||
|
using SessionCompanion.ViewModels.ShopkeeperViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Controllers
|
||||||
|
{
|
||||||
|
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/shopkeeper")]
|
||||||
|
public class ShopkeeperController : Controller
|
||||||
|
{
|
||||||
|
private IShopkeeperService _service;
|
||||||
|
public ShopkeeperController(IShopkeeperService shopkeeperService)
|
||||||
|
{
|
||||||
|
_service = shopkeeperService;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Endpoint zwracający liste sklepikarzy
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Lista sklepikarzy</returns>
|
||||||
|
[HttpGet("getShopkeepers")]
|
||||||
|
public async Task<List<ShopkeeperViewModel>> GetShopkeepers()
|
||||||
|
{
|
||||||
|
return _service.Get().ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user