Skip to content

Commit

Permalink
Parser and database saving
Browse files Browse the repository at this point in the history
  • Loading branch information
Ingafen committed Apr 2, 2022
1 parent dc6071e commit 8be0b3b
Show file tree
Hide file tree
Showing 49 changed files with 1,282 additions and 78 deletions.
10 changes: 7 additions & 3 deletions StarWarsKb.Back/Controllers/CharactersController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ namespace StarWarsKb.Back.Controllers
[Route("[controller]")]
public class CharactersController : ControllerBase
{
private readonly ICharactersRepository _charactersRepository;
private readonly IBaseRepository<Character> _charactersRepository;

public CharactersController(ICharactersRepository charactersRepository)
public CharactersController(IBaseRepository<Character> charactersRepository)
{
_charactersRepository = charactersRepository;
}
Expand All @@ -20,6 +20,10 @@ public CharactersController(ICharactersRepository charactersRepository)
public IList<Character> Get() => _charactersRepository.GetAll();

[HttpGet("{id}")]
public Character Get(int id) => _charactersRepository.GetById(id);
public Character Get(int id)
{
var byId = _charactersRepository.GetById(id);
return byId;
}
}
}
213 changes: 213 additions & 0 deletions StarWarsKb.Back/Migrations/20220402083803_parsemigration.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

89 changes: 89 additions & 0 deletions StarWarsKb.Back/Migrations/20220402083803_parsemigration.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
using Microsoft.EntityFrameworkCore.Migrations;

namespace StarWarsKb.Back.Migrations
{
public partial class parsemigration : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "Climate",
table: "Planets",
nullable: true);

migrationBuilder.AddColumn<int>(
name: "Diameter",
table: "Planets",
nullable: false,
defaultValue: 0);

migrationBuilder.AddColumn<string>(
name: "Gravity",
table: "Planets",
nullable: true);

migrationBuilder.AddColumn<int>(
name: "OrbitalPeriod",
table: "Planets",
nullable: false,
defaultValue: 0);

migrationBuilder.AddColumn<int>(
name: "Population",
table: "Planets",
nullable: false,
defaultValue: 0);

migrationBuilder.AddColumn<int>(
name: "RotationPeriod",
table: "Planets",
nullable: false,
defaultValue: 0);

migrationBuilder.AddColumn<string>(
name: "SurfaceWater",
table: "Planets",
nullable: true);

migrationBuilder.AddColumn<string>(
name: "Terrain",
table: "Planets",
nullable: true);
}

protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Climate",
table: "Planets");

migrationBuilder.DropColumn(
name: "Diameter",
table: "Planets");

migrationBuilder.DropColumn(
name: "Gravity",
table: "Planets");

migrationBuilder.DropColumn(
name: "OrbitalPeriod",
table: "Planets");

migrationBuilder.DropColumn(
name: "Population",
table: "Planets");

migrationBuilder.DropColumn(
name: "RotationPeriod",
table: "Planets");

migrationBuilder.DropColumn(
name: "SurfaceWater",
table: "Planets");

migrationBuilder.DropColumn(
name: "Terrain",
table: "Planets");
}
}
}
Loading

0 comments on commit 8be0b3b

Please sign in to comment.