Compare commits
1 Commits
master
...
feature/re
| Author | SHA1 | Date |
|---|---|---|
|
|
1513c9eaed |
|
|
@ -1,9 +1,6 @@
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Portfolio.Application.Services.Articles;
|
using Portfolio.Application.Services.Articles;
|
||||||
using Portfolio.Application.Services.NWSWeatherService;
|
|
||||||
using Portfolio.Application.Services.PokemonNatureService;
|
|
||||||
using Portfolio.Application.Services.PokemonService;
|
using Portfolio.Application.Services.PokemonService;
|
||||||
using Portfolio.Application.Services.PokemonSubskillService;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
@ -18,9 +15,6 @@ namespace Portfolio.Application
|
||||||
{
|
{
|
||||||
services.AddScoped<IArticleService, ArticleService>();
|
services.AddScoped<IArticleService, ArticleService>();
|
||||||
services.AddScoped<IPokemonService, PokemonService>();
|
services.AddScoped<IPokemonService, PokemonService>();
|
||||||
services.AddScoped<IPokemonSubskillService, PokemonSubskillService>();
|
|
||||||
services.AddScoped<IPokemonNatureService, PokemonNatureService>();
|
|
||||||
//services.AddScoped<INWSWeatherService, NWSWeatherService>();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,8 @@
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.2" />
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.2" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Http" Version="9.0.2" />
|
||||||
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,90 @@
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Portfolio.Domain.Features.Dtos;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Net;
|
||||||
|
using System.Net.Http;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using static Portfolio.Domain.Utility.StaticDetails;
|
||||||
|
|
||||||
|
namespace Portfolio.Application.Services
|
||||||
|
{
|
||||||
|
public class BaseService : IBaseService
|
||||||
|
{
|
||||||
|
|
||||||
|
private readonly IHttpClientFactory _httpClientFactory;
|
||||||
|
|
||||||
|
public BaseService(IHttpClientFactory httpClientFactory)
|
||||||
|
{
|
||||||
|
_httpClientFactory = httpClientFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public async Task<ResponseDto?> SendAsync(RequestDto requestDto)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
HttpClient client = _httpClientFactory.CreateClient("PokemonSleepAPI");
|
||||||
|
HttpRequestMessage message = new();
|
||||||
|
message.Headers.Add("Accept", "application/json");
|
||||||
|
|
||||||
|
//token here
|
||||||
|
|
||||||
|
message.RequestUri = new Uri(requestDto.Url);
|
||||||
|
if (requestDto.Data != null)
|
||||||
|
{
|
||||||
|
message.Content = new StringContent(JsonConvert.SerializeObject(requestDto.Data), Encoding.UTF8, "application/json");
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpResponseMessage? apiResponse = null;
|
||||||
|
|
||||||
|
switch (requestDto.ApiType)
|
||||||
|
{
|
||||||
|
case ApiType.POST:
|
||||||
|
message.Method = HttpMethod.Post;
|
||||||
|
break;
|
||||||
|
case ApiType.DELETE:
|
||||||
|
message.Method = HttpMethod.Delete;
|
||||||
|
break;
|
||||||
|
case ApiType.PUT:
|
||||||
|
message.Method = HttpMethod.Put;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
message.Method = HttpMethod.Get;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
apiResponse = await client.SendAsync(message);
|
||||||
|
|
||||||
|
switch (apiResponse.StatusCode)
|
||||||
|
{
|
||||||
|
case HttpStatusCode.NotFound:
|
||||||
|
return new() { IsSuccess = false, Message = "Not Found." };
|
||||||
|
case HttpStatusCode.Forbidden:
|
||||||
|
return new() { IsSuccess = false, Message = "Access Denied." };
|
||||||
|
case HttpStatusCode.Unauthorized:
|
||||||
|
return new() { IsSuccess = false, Message = "Unauthorized." };
|
||||||
|
case HttpStatusCode.InternalServerError:
|
||||||
|
return new() { IsSuccess = false, Message = "Internal Server Error." };
|
||||||
|
default:
|
||||||
|
var apiContent = await apiResponse.Content.ReadAsStringAsync();
|
||||||
|
var apiResponseDto = JsonConvert.DeserializeObject<ResponseDto>(apiContent);
|
||||||
|
return apiResponseDto;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
var dto = new ResponseDto
|
||||||
|
{
|
||||||
|
IsSuccess = false,
|
||||||
|
Message = ex.Message.ToString()
|
||||||
|
};
|
||||||
|
return dto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
using Portfolio.Domain.Features.Dtos;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Portfolio.Application.Services
|
||||||
|
{
|
||||||
|
public interface IBaseService
|
||||||
|
{
|
||||||
|
Task<ResponseDto?> SendAsync(RequestDto requestDto);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
using Portfolio.Domain.Features.TemperatureDay;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Portfolio.Application.Services.NWSWeatherService
|
|
||||||
{
|
|
||||||
public interface INWSWeatherService
|
|
||||||
{
|
|
||||||
Task<string> GetNearestStationAsync(double latitude, double longitude);
|
|
||||||
Task<double?> GetDailyAverageTempAsync(string stationId, DateTime date);
|
|
||||||
Task<List<TemperatureDay>> GetTemperatureDataAsync(double latitude, double longitude, int year);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,123 +0,0 @@
|
||||||
using Portfolio.Domain.Features.TemperatureDay;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Text.Json;
|
|
||||||
using System.Text.Json.Serialization;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Portfolio.Application.Services.NWSWeatherService
|
|
||||||
{
|
|
||||||
public class NWSWeatherService : INWSWeatherService
|
|
||||||
{
|
|
||||||
private readonly HttpClient _httpClient;
|
|
||||||
|
|
||||||
public NWSWeatherService(HttpClient httpClient)
|
|
||||||
{
|
|
||||||
_httpClient = httpClient;
|
|
||||||
_httpClient.DefaultRequestHeaders.Add("User-Agent", "kira.jiroux@gmail.com"); // Replace with your email ideally
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<string> GetNearestStationAsync(double latitude, double longitude)
|
|
||||||
{
|
|
||||||
var url = $"https://api.weather.gov/points/{latitude},{longitude}";
|
|
||||||
var response = await _httpClient.GetAsync(url);
|
|
||||||
response.EnsureSuccessStatusCode();
|
|
||||||
|
|
||||||
using var stream = await response.Content.ReadAsStreamAsync();
|
|
||||||
var json = await JsonDocument.ParseAsync(stream);
|
|
||||||
|
|
||||||
var stationUrl = json.RootElement
|
|
||||||
.GetProperty("properties")
|
|
||||||
.GetProperty("observationStations")
|
|
||||||
.GetString();
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(stationUrl))
|
|
||||||
throw new Exception("Could not find station info.");
|
|
||||||
|
|
||||||
var stationListResponse = await _httpClient.GetAsync(stationUrl);
|
|
||||||
stationListResponse.EnsureSuccessStatusCode();
|
|
||||||
|
|
||||||
using var stationStream = await stationListResponse.Content.ReadAsStreamAsync();
|
|
||||||
var stationJson = await JsonDocument.ParseAsync(stationStream);
|
|
||||||
|
|
||||||
var firstStation = stationJson.RootElement
|
|
||||||
.GetProperty("features")[0]
|
|
||||||
.GetProperty("properties")
|
|
||||||
.GetProperty("stationIdentifier")
|
|
||||||
.GetString();
|
|
||||||
|
|
||||||
return firstStation;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<double?> GetDailyAverageTempAsync(string stationId, DateTime date)
|
|
||||||
{
|
|
||||||
var start = date.ToString("yyyy-MM-dd") + "T00:00:00Z";
|
|
||||||
var end = date.ToString("yyyy-MM-dd") + "T23:59:59Z";
|
|
||||||
|
|
||||||
var url = $"https://api.weather.gov/stations/{stationId}/observations?start={start}&end={end}";
|
|
||||||
var response = await _httpClient.GetAsync(url);
|
|
||||||
response.EnsureSuccessStatusCode();
|
|
||||||
|
|
||||||
using var stream = await response.Content.ReadAsStreamAsync();
|
|
||||||
var json = await JsonDocument.ParseAsync(stream);
|
|
||||||
|
|
||||||
var temps = new List<double>();
|
|
||||||
|
|
||||||
foreach (var feature in json.RootElement.GetProperty("features").EnumerateArray())
|
|
||||||
{
|
|
||||||
if (feature.TryGetProperty("properties", out var props) &&
|
|
||||||
props.TryGetProperty("temperature", out var tempObj) &&
|
|
||||||
tempObj.TryGetProperty("value", out var valueProp) &&
|
|
||||||
valueProp.ValueKind == JsonValueKind.Number)
|
|
||||||
{
|
|
||||||
var celsius = valueProp.GetDouble();
|
|
||||||
if (!double.IsNaN(celsius))
|
|
||||||
{
|
|
||||||
var fahrenheit = (celsius * 9.0 / 5.0) + 32.0;
|
|
||||||
temps.Add(fahrenheit);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (temps.Count == 0)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
return temps.Average();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<List<TemperatureDay>> GetTemperatureDataAsync(double latitude, double longitude, int year)
|
|
||||||
{
|
|
||||||
var stationId = await GetNearestStationAsync(latitude, longitude);
|
|
||||||
|
|
||||||
var result = new List<TemperatureDay>();
|
|
||||||
|
|
||||||
var startDate = new DateTime(year, 1, 1);
|
|
||||||
var endDate = new DateTime(year, 12, 31);
|
|
||||||
|
|
||||||
for (var date = startDate; date <= endDate; date = date.AddDays(1))
|
|
||||||
{
|
|
||||||
Console.WriteLine($"Fetching {date:yyyy-MM-dd}...");
|
|
||||||
var avgTemp = await GetDailyAverageTempAsync(stationId, date);
|
|
||||||
|
|
||||||
if (avgTemp.HasValue)
|
|
||||||
{
|
|
||||||
result.Add(new TemperatureDay
|
|
||||||
{
|
|
||||||
Date = date,
|
|
||||||
AvgTemp = Math.Round(avgTemp.Value, 1)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Console.WriteLine($"No data for {date:yyyy-MM-dd}");
|
|
||||||
}
|
|
||||||
|
|
||||||
await Task.Delay(600); // small delay to be nice to NWS
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
using Portfolio.Domain.Features.Pokemon_Natures;
|
using System;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
@ -9,6 +8,5 @@ namespace Portfolio.Application.Services.PokemonNatureService
|
||||||
{
|
{
|
||||||
public interface IPokemonNatureService
|
public interface IPokemonNatureService
|
||||||
{
|
{
|
||||||
Task<List<PokemonNature>> GetAllPokemonNaturesAsync();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
using Portfolio.Domain.Features.Pokemon;
|
using System;
|
||||||
using Portfolio.Domain.Features.Pokemon_Natures;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
@ -10,16 +8,5 @@ namespace Portfolio.Application.Services.PokemonNatureService
|
||||||
{
|
{
|
||||||
public class PokemonNatureService : IPokemonNatureService
|
public class PokemonNatureService : IPokemonNatureService
|
||||||
{
|
{
|
||||||
private readonly IPokemonNatureRepository _pokemonNatureRepository;
|
|
||||||
|
|
||||||
public PokemonNatureService(IPokemonNatureRepository pokemonNatureRepository)
|
|
||||||
{
|
|
||||||
_pokemonNatureRepository = pokemonNatureRepository;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<List<PokemonNature>> GetAllPokemonNaturesAsync()
|
|
||||||
{
|
|
||||||
return await _pokemonNatureRepository.GetAllPokemonNaturesAsync();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using Portfolio.Domain.Features.Pokemon;
|
using Portfolio.Domain.Features.Dtos;
|
||||||
|
using Portfolio.Domain.Features.Pokemon;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
@ -9,15 +10,6 @@ namespace Portfolio.Application.Services.PokemonService
|
||||||
{
|
{
|
||||||
public interface IPokemonService
|
public interface IPokemonService
|
||||||
{
|
{
|
||||||
Task<List<Pokemon>> GetAllPokemonAsync();
|
Task<List<PokemonDto>> GetAllPokemonAsync();
|
||||||
Task<Pokemon> GetPokemonByPokemonIdAsync(int id);
|
|
||||||
Task<Pokemon> GetPokemonByIdAsync(int id);
|
|
||||||
Task<List<int>> GetAllPokemonIdsAsync();
|
|
||||||
Task<int?> GetPreviousPokemonIdAsync(int id);
|
|
||||||
Task<int?> GetNextPokemonIdAsync(int id);
|
|
||||||
Task<int?> GetVariationPokemonIdAsync(int id);
|
|
||||||
Task AddPokemonAsync(Pokemon pokemon);
|
|
||||||
Task DeletePokemonAsync(int pokemonId);
|
|
||||||
Task UpdatePokemonAsync(Pokemon pokemon);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,12 @@
|
||||||
using Portfolio.Domain.Features.Articles;
|
using Newtonsoft.Json;
|
||||||
|
using Portfolio.Domain.Features.Articles;
|
||||||
|
using Portfolio.Domain.Features.Dtos;
|
||||||
using Portfolio.Domain.Features.Pokemon;
|
using Portfolio.Domain.Features.Pokemon;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net.Http;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Portfolio.Application.Services.PokemonService
|
namespace Portfolio.Application.Services.PokemonService
|
||||||
|
|
@ -17,56 +19,82 @@ namespace Portfolio.Application.Services.PokemonService
|
||||||
{
|
{
|
||||||
_pokemonRepository = pokemonRepository;
|
_pokemonRepository = pokemonRepository;
|
||||||
}
|
}
|
||||||
|
public async Task<List<PokemonDto>> GetAllPokemonAsync()
|
||||||
public async Task AddPokemonAsync(Pokemon pokemon)
|
|
||||||
{
|
{
|
||||||
await _pokemonRepository.AddPokemonAsync(pokemon);
|
List<PokemonDto> pokemons = new List<PokemonDto>();
|
||||||
}
|
ResponseDto? response = await _pokemonRepository.GetAllPokemon();
|
||||||
public async Task DeletePokemonAsync(int pokemonId)
|
|
||||||
{
|
|
||||||
await _pokemonRepository.DeletePokemonAsync(pokemonId);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<List<Pokemon>> GetAllPokemonAsync()
|
if (response != null && response.IsSuccess)
|
||||||
{
|
{
|
||||||
return await _pokemonRepository.GetAllPokemonsAsync();
|
pokemons = JsonConvert.DeserializeObject<List<PokemonDto>>(Convert.ToString(response.Result));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
return pokemons;
|
||||||
|
|
||||||
public async Task<List<int>> GetAllPokemonIdsAsync()
|
|
||||||
{
|
//return new List<Pokemon>() {
|
||||||
return await _pokemonRepository.GetAllPokemonIdsAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<int?> GetNextPokemonIdAsync(int id)
|
// new Pokemon
|
||||||
{
|
// {
|
||||||
return await _pokemonRepository.GetNextPokemonIdAsync(id);
|
// PokemonId = 1,
|
||||||
}
|
// PokemonName = "Bulbasaur",
|
||||||
|
// SleepType = "Dozing",
|
||||||
|
// Speciality = "Ingredients"
|
||||||
|
|
||||||
public async Task<Pokemon> GetPokemonByPokemonIdAsync(int id)
|
// },
|
||||||
{
|
// new Pokemon
|
||||||
return await _pokemonRepository.GetPokemonByPokemonIdAsync(id);
|
// {
|
||||||
}
|
// PokemonId = 2,
|
||||||
|
// PokemonName = "Ivysaur",
|
||||||
|
// SleepType = "Dozing",
|
||||||
|
// Speciality = "Ingredients"
|
||||||
|
|
||||||
public async Task<Pokemon> GetPokemonByIdAsync(int id)
|
// },
|
||||||
{
|
// new Pokemon
|
||||||
return await _pokemonRepository.GetPokemonByIdAsync(id);
|
// {
|
||||||
}
|
// PokemonId = 3,
|
||||||
|
// PokemonName = "Venasaur",
|
||||||
|
// SleepType = "Dozing",
|
||||||
|
// Speciality = "Ingredients"
|
||||||
|
|
||||||
public async Task<int?> GetPreviousPokemonIdAsync(int id)
|
// },
|
||||||
{
|
// new Pokemon
|
||||||
return await _pokemonRepository.GetPreviousPokemonIdAsync(id);
|
// {
|
||||||
|
// PokemonId = 37,
|
||||||
|
// PokemonName = "Vulpix",
|
||||||
|
// SleepType = "Snoozing",
|
||||||
|
// Speciality = "Berries"
|
||||||
|
|
||||||
}
|
// },
|
||||||
|
// new Pokemon
|
||||||
|
// {
|
||||||
|
// PokemonId = 38,
|
||||||
|
// PokemonName = "Ninetails",
|
||||||
|
// SleepType = "Snoozing",
|
||||||
|
// Speciality = "Berries"
|
||||||
|
|
||||||
public async Task UpdatePokemonAsync(Pokemon pokemon)
|
// },
|
||||||
{
|
// new Pokemon
|
||||||
await _pokemonRepository.UpdatePokemonAsync(pokemon);
|
// {
|
||||||
}
|
// PokemonId = 37,
|
||||||
|
// PokemonName = "Vulpix",
|
||||||
|
// IsVariation = true,
|
||||||
|
// VariationName = "Alolan",
|
||||||
|
// SleepType = "Slumbering",
|
||||||
|
// Speciality = "Berries"
|
||||||
|
|
||||||
public async Task<int?> GetVariationPokemonIdAsync(int id)
|
// },
|
||||||
{
|
// new Pokemon
|
||||||
return await _pokemonRepository.GetVariationPokemonIdAsync(id);
|
// {
|
||||||
|
// PokemonId = 38,
|
||||||
|
// PokemonName = "Ninetails",
|
||||||
|
// IsVariation = true,
|
||||||
|
// VariationName = "Alolan",
|
||||||
|
// SleepType = "Slumbering",
|
||||||
|
// Speciality = "Berries"
|
||||||
|
|
||||||
|
// },
|
||||||
|
//};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
using Portfolio.Domain.Features.Pokemon_Subskills;
|
using System;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
@ -9,7 +8,5 @@ namespace Portfolio.Application.Services.PokemonSubskillService
|
||||||
{
|
{
|
||||||
public interface IPokemonSubskillService
|
public interface IPokemonSubskillService
|
||||||
{
|
{
|
||||||
Task<List<PokemonSubskill>> GetAllPokemonSubskillsAsync();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
using Portfolio.Domain.Features.Pokemon;
|
using System;
|
||||||
using Portfolio.Domain.Features.Pokemon_Subskills;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
@ -10,16 +8,5 @@ namespace Portfolio.Application.Services.PokemonSubskillService
|
||||||
{
|
{
|
||||||
public class PokemonSubskillService : IPokemonSubskillService
|
public class PokemonSubskillService : IPokemonSubskillService
|
||||||
{
|
{
|
||||||
private readonly IPokemonSubskillRepository _pokemonSubskillRepository;
|
|
||||||
|
|
||||||
public PokemonSubskillService(IPokemonSubskillRepository pokemonSubskillRepository)
|
|
||||||
{
|
|
||||||
_pokemonSubskillRepository = pokemonSubskillRepository;
|
|
||||||
}
|
|
||||||
public async Task<List<PokemonSubskill>> GetAllPokemonSubskillsAsync()
|
|
||||||
{
|
|
||||||
Console.WriteLine("Does this fire every time");
|
|
||||||
return await _pokemonSubskillRepository.GetAllPokemonSubskillsAsync();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Portfolio.Domain.Features.Dtos
|
||||||
|
{
|
||||||
|
public class PokemonDto
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public int PokemonId { get; set; }
|
||||||
|
public required string PokemonName { get; set; }
|
||||||
|
public bool IsVariation { get; set; } = false;
|
||||||
|
public string? VariationName { get; set; }
|
||||||
|
public required string SleepType { get; set; }
|
||||||
|
public required string Speciality { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Security.AccessControl;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using static Portfolio.Domain.Utility.StaticDetails;
|
||||||
|
|
||||||
|
namespace Portfolio.Domain.Features.Dtos
|
||||||
|
{
|
||||||
|
public class RequestDto
|
||||||
|
{
|
||||||
|
public ApiType ApiType { get; set; } = ApiType.GET;
|
||||||
|
public string Url { get; set; }
|
||||||
|
public object Data { get; set; }
|
||||||
|
public string AccessToken { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Portfolio.Domain.Features.Dtos
|
||||||
|
{
|
||||||
|
public class ResponseDto
|
||||||
|
{
|
||||||
|
public object? Result { get; set; }
|
||||||
|
public bool IsSuccess { get; set; }
|
||||||
|
public string Message { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Portfolio.Domain.Features.Pokemon_Natures
|
|
||||||
{
|
|
||||||
public interface IPokemonNatureRepository
|
|
||||||
{
|
|
||||||
Task<List<PokemonNature>> GetAllPokemonNaturesAsync();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Portfolio.Domain.Features.Pokemon_Natures
|
namespace Portfolio.Domain.Features.Pokemon_Natures
|
||||||
{
|
{
|
||||||
public class PokemonNature
|
public class PokemonNatures
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public string Nature { get; set; }
|
public string Nature { get; set; }
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Portfolio.Domain.Features.Pokemon_Subskills
|
|
||||||
{
|
|
||||||
public interface IPokemonSubskillRepository
|
|
||||||
{
|
|
||||||
Task<List<PokemonSubskill>> GetAllPokemonSubskillsAsync();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Portfolio.Domain.Features.Pokemon_Subskills
|
namespace Portfolio.Domain.Features.Pokemon_Subskills
|
||||||
{
|
{
|
||||||
public class PokemonSubskill
|
public class PokemonSubskills
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public string SubSkill { get; set; }
|
public string SubSkill { get; set; }
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using Portfolio.Domain.Features.Dtos;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
@ -8,16 +9,6 @@ namespace Portfolio.Domain.Features.Pokemon
|
||||||
{
|
{
|
||||||
public interface IPokemonRepository
|
public interface IPokemonRepository
|
||||||
{
|
{
|
||||||
Task<List<Pokemon>> GetAllPokemonsAsync();
|
Task<ResponseDto> GetAllPokemon();
|
||||||
Task<Pokemon> GetPokemonByIdAsync(int id);
|
|
||||||
Task<Pokemon> GetPokemonByPokemonIdAsync(int id);
|
|
||||||
Task<List<int>> GetAllPokemonIdsAsync();
|
|
||||||
Task<int?> GetPreviousPokemonIdAsync(int currentPokemonId);
|
|
||||||
Task<int?> GetNextPokemonIdAsync(int currentPokemonId);
|
|
||||||
Task<int?> GetVariationPokemonIdAsync(int pokemonId);
|
|
||||||
Task AddPokemonAsync(Pokemon pokemon);
|
|
||||||
Task DeletePokemonAsync(int pokemonId);
|
|
||||||
Task UpdatePokemonAsync(Pokemon pokemon);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Portfolio.Domain.Features.Pokemon
|
|
||||||
{
|
|
||||||
public class Ingredient
|
|
||||||
{
|
|
||||||
public string Name { get; set; }
|
|
||||||
public string Description { get; set; }
|
|
||||||
public string ImageURL { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -13,19 +13,8 @@ namespace Portfolio.Domain.Features.Pokemon
|
||||||
public required string PokemonName { get; set; }
|
public required string PokemonName { get; set; }
|
||||||
public bool IsVariation { get; set; } = false;
|
public bool IsVariation { get; set; } = false;
|
||||||
public string? VariationName { get; set; }
|
public string? VariationName { get; set; }
|
||||||
public required string PokemonType { get; set; }
|
|
||||||
public required string SleepType { get; set; }
|
public required string SleepType { get; set; }
|
||||||
public required string Speciality { get; set; }
|
public required string Speciality { get; set; }
|
||||||
public string? Skill { get; set; }
|
|
||||||
public string? SkillDescription { get; set; }
|
|
||||||
public string? PokemonImageUrl { get; set; }
|
|
||||||
public string? PokemonShinyImageUrl { get; set; }
|
|
||||||
public string[]? PokemonSleepStyleImageUrls { get; set; }
|
|
||||||
public string? FlavorText { get; set; }
|
|
||||||
public string? Ingredient1 { get; set; }
|
|
||||||
public string? Ingredient2 { get; set; }
|
|
||||||
public string? Ingredient3 { get; set; }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
using Portfolio.Domain.Features.Abstractions;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Portfolio.Domain.Features.Pokemon
|
|
||||||
{
|
|
||||||
public class PokemonType : Entity
|
|
||||||
{
|
|
||||||
public string Type { get; set; }
|
|
||||||
public string TypeImageUrl { get; set; }
|
|
||||||
public string Berry { get; set; }
|
|
||||||
public string BerryDescription { get; set; }
|
|
||||||
public string BerryImageUrl { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Portfolio.Domain.Features.Portfolio
|
|
||||||
{
|
|
||||||
public class ProjectEntry
|
|
||||||
{
|
|
||||||
public string Title { get; set; }
|
|
||||||
public List<string> Descriptions { get; set; }
|
|
||||||
public List<ProjectLink> Links { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Portfolio.Domain.Features.Portfolio
|
|
||||||
{
|
|
||||||
public class ProjectLink
|
|
||||||
{
|
|
||||||
public string Type { get; set; }
|
|
||||||
public string Url { get; set; }
|
|
||||||
public string Label { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Portfolio.Domain.Features.Portfolio
|
|
||||||
{
|
|
||||||
public class WorkExperience
|
|
||||||
{
|
|
||||||
public string Title { get; set; }
|
|
||||||
public string Company { get; set; }
|
|
||||||
public int StartYear { get; set; }
|
|
||||||
public int EndYear { get; set; }
|
|
||||||
public string Details { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Portfolio.Domain.Features.TemperatureDay
|
|
||||||
{
|
|
||||||
public class TemperatureDay
|
|
||||||
{
|
|
||||||
public DateTime Date { get; set; }
|
|
||||||
public double AvgTemp { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Portfolio.Domain.Features.TemperatureRange
|
|
||||||
{
|
|
||||||
public class TemperatureRange
|
|
||||||
{
|
|
||||||
public double Min { get; set; }
|
|
||||||
public double Max { get; set; }
|
|
||||||
public string Color { get; set; } = "#ffffff";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Portfolio.Domain.Utility
|
||||||
|
{
|
||||||
|
public class StaticDetails
|
||||||
|
{
|
||||||
|
public static string PokemonSleepAPIBase { get; set; }
|
||||||
|
public enum ApiType
|
||||||
|
{
|
||||||
|
GET, POST, PUT, DELETE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -13,13 +13,241 @@ namespace Portfolio.Infrastructure
|
||||||
{
|
{
|
||||||
public class ApplicationDbContext : DbContext
|
public class ApplicationDbContext : DbContext
|
||||||
{
|
{
|
||||||
public ApplicationDbContext(DbContextOptions options) :base(options)
|
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options) : base(options)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
public DbSet<Pokemon> Pokemons { get; set; }
|
public DbSet<Pokemon> Pokemons { get; set; }
|
||||||
public DbSet<PokemonNature> PokemonNatures { get; set; }
|
public DbSet<PokemonNatures> PokemonNatures { get; set; }
|
||||||
public DbSet<PokemonSubskill> PokemonSubskills { get; set; }
|
public DbSet<PokemonSubskills> PokemonSubskills { get; set; }
|
||||||
|
|
||||||
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
base.OnModelCreating(modelBuilder);
|
||||||
|
|
||||||
|
|
||||||
|
//Pokemon
|
||||||
|
modelBuilder.Entity<Pokemon>().HasData(new Pokemon
|
||||||
|
{
|
||||||
|
Id = 1,
|
||||||
|
PokemonId = 1,
|
||||||
|
PokemonName = "Bulbasaur",
|
||||||
|
SleepType = "Dozing",
|
||||||
|
Speciality = "Ingredients"
|
||||||
|
|
||||||
|
});
|
||||||
|
modelBuilder.Entity<Pokemon>().HasData(new Pokemon
|
||||||
|
{
|
||||||
|
Id = 2,
|
||||||
|
PokemonId = 2,
|
||||||
|
PokemonName = "Ivysaur",
|
||||||
|
SleepType = "Dozing",
|
||||||
|
Speciality = "Ingredients"
|
||||||
|
|
||||||
|
});
|
||||||
|
modelBuilder.Entity<Pokemon>().HasData(new Pokemon
|
||||||
|
{
|
||||||
|
Id = 3,
|
||||||
|
PokemonId = 3,
|
||||||
|
PokemonName = "Venasaur",
|
||||||
|
SleepType = "Dozing",
|
||||||
|
Speciality = "Ingredients"
|
||||||
|
|
||||||
|
});
|
||||||
|
modelBuilder.Entity<Pokemon>().HasData(new Pokemon
|
||||||
|
{
|
||||||
|
Id = 4,
|
||||||
|
PokemonId = 4,
|
||||||
|
PokemonName = "Charmander",
|
||||||
|
SleepType = "Snoozing",
|
||||||
|
Speciality = "Ingredients"
|
||||||
|
|
||||||
|
});
|
||||||
|
modelBuilder.Entity<Pokemon>().HasData(new Pokemon
|
||||||
|
{
|
||||||
|
Id = 5,
|
||||||
|
PokemonId = 5,
|
||||||
|
PokemonName = "Charmeleon",
|
||||||
|
SleepType = "Snoozing",
|
||||||
|
Speciality = "Ingredients"
|
||||||
|
|
||||||
|
});
|
||||||
|
modelBuilder.Entity<Pokemon>().HasData(new Pokemon
|
||||||
|
{
|
||||||
|
Id = 6,
|
||||||
|
PokemonId = 6,
|
||||||
|
PokemonName = "Charizard",
|
||||||
|
SleepType = "Snoozing",
|
||||||
|
Speciality = "Ingredients"
|
||||||
|
|
||||||
|
});
|
||||||
|
modelBuilder.Entity<Pokemon>().HasData(new Pokemon
|
||||||
|
{
|
||||||
|
Id = 7,
|
||||||
|
PokemonId = 7,
|
||||||
|
PokemonName = "Squirtle",
|
||||||
|
SleepType = "Slumbering",
|
||||||
|
Speciality = "Ingredients"
|
||||||
|
|
||||||
|
});
|
||||||
|
modelBuilder.Entity<Pokemon>().HasData(new Pokemon
|
||||||
|
{
|
||||||
|
Id = 8,
|
||||||
|
PokemonId = 8,
|
||||||
|
PokemonName = "Wartortle",
|
||||||
|
SleepType = "Slumbering",
|
||||||
|
Speciality = "Ingredients"
|
||||||
|
|
||||||
|
});
|
||||||
|
modelBuilder.Entity<Pokemon>().HasData(new Pokemon
|
||||||
|
{
|
||||||
|
Id = 9,
|
||||||
|
PokemonId = 9,
|
||||||
|
PokemonName = "Blastoise",
|
||||||
|
SleepType = "Slumbering",
|
||||||
|
Speciality = "Ingredients"
|
||||||
|
|
||||||
|
});
|
||||||
|
modelBuilder.Entity<Pokemon>().HasData(new Pokemon
|
||||||
|
{
|
||||||
|
Id = 10,
|
||||||
|
PokemonId = 10,
|
||||||
|
PokemonName = "Caterpie",
|
||||||
|
SleepType = "Dozing",
|
||||||
|
Speciality = "Berries"
|
||||||
|
|
||||||
|
});
|
||||||
|
modelBuilder.Entity<Pokemon>().HasData(new Pokemon
|
||||||
|
{
|
||||||
|
Id = 11,
|
||||||
|
PokemonId = 11,
|
||||||
|
PokemonName = "Metapod",
|
||||||
|
SleepType = "Dozing",
|
||||||
|
Speciality = "Berries"
|
||||||
|
|
||||||
|
});
|
||||||
|
modelBuilder.Entity<Pokemon>().HasData(new Pokemon
|
||||||
|
{
|
||||||
|
Id = 12,
|
||||||
|
PokemonId = 12,
|
||||||
|
PokemonName = "Butterfree",
|
||||||
|
SleepType = "Dozing",
|
||||||
|
Speciality = "Berries"
|
||||||
|
|
||||||
|
});
|
||||||
|
modelBuilder.Entity<Pokemon>().HasData(new Pokemon
|
||||||
|
{
|
||||||
|
Id = 13,
|
||||||
|
PokemonId = 19,
|
||||||
|
PokemonName = "Rattata",
|
||||||
|
SleepType = "Snoozing",
|
||||||
|
Speciality = "Berries"
|
||||||
|
|
||||||
|
});
|
||||||
|
modelBuilder.Entity<Pokemon>().HasData(new Pokemon
|
||||||
|
{
|
||||||
|
Id = 14,
|
||||||
|
PokemonId = 20,
|
||||||
|
PokemonName = "Raticate",
|
||||||
|
SleepType = "Snoozing",
|
||||||
|
Speciality = "Berries"
|
||||||
|
|
||||||
|
});
|
||||||
|
modelBuilder.Entity<Pokemon>().HasData(new Pokemon
|
||||||
|
{
|
||||||
|
Id = 15,
|
||||||
|
PokemonId = 23,
|
||||||
|
PokemonName = "Ekans",
|
||||||
|
SleepType = "Dozing",
|
||||||
|
Speciality = "Berries"
|
||||||
|
|
||||||
|
});
|
||||||
|
modelBuilder.Entity<Pokemon>().HasData(new Pokemon
|
||||||
|
{
|
||||||
|
Id = 16,
|
||||||
|
PokemonId = 24,
|
||||||
|
PokemonName = "Arbok",
|
||||||
|
SleepType = "Dozing",
|
||||||
|
Speciality = "Berries"
|
||||||
|
|
||||||
|
});
|
||||||
|
modelBuilder.Entity<Pokemon>().HasData(new Pokemon
|
||||||
|
{
|
||||||
|
Id = 17,
|
||||||
|
PokemonId = 25,
|
||||||
|
PokemonName = "Pikachu",
|
||||||
|
SleepType = "Snoozing",
|
||||||
|
Speciality = "Berries"
|
||||||
|
|
||||||
|
});
|
||||||
|
modelBuilder.Entity<Pokemon>().HasData(new Pokemon
|
||||||
|
{
|
||||||
|
Id = 18,
|
||||||
|
PokemonId = 26,
|
||||||
|
PokemonName = "Raticate",
|
||||||
|
SleepType = "Snoozing",
|
||||||
|
Speciality = "Berries"
|
||||||
|
|
||||||
|
});
|
||||||
|
modelBuilder.Entity<Pokemon>().HasData(new Pokemon
|
||||||
|
{
|
||||||
|
Id = 19,
|
||||||
|
PokemonId = 35,
|
||||||
|
PokemonName = "Clefairy",
|
||||||
|
SleepType = "Snoozing",
|
||||||
|
Speciality = "Berries"
|
||||||
|
|
||||||
|
});
|
||||||
|
modelBuilder.Entity<Pokemon>().HasData(new Pokemon
|
||||||
|
{
|
||||||
|
Id = 20,
|
||||||
|
PokemonId = 36,
|
||||||
|
PokemonName = "Clefable",
|
||||||
|
SleepType = "Snoozing",
|
||||||
|
Speciality = "Berries"
|
||||||
|
|
||||||
|
});
|
||||||
|
modelBuilder.Entity<Pokemon>().HasData(new Pokemon
|
||||||
|
{
|
||||||
|
Id = 21,
|
||||||
|
PokemonId = 37,
|
||||||
|
PokemonName = "Vulpix",
|
||||||
|
SleepType = "Snoozing",
|
||||||
|
Speciality = "Berries"
|
||||||
|
|
||||||
|
});
|
||||||
|
modelBuilder.Entity<Pokemon>().HasData(new Pokemon
|
||||||
|
{
|
||||||
|
Id = 22,
|
||||||
|
PokemonId = 38,
|
||||||
|
PokemonName = "Ninetails",
|
||||||
|
SleepType = "Snoozing",
|
||||||
|
Speciality = "Berries"
|
||||||
|
|
||||||
|
});
|
||||||
|
modelBuilder.Entity<Pokemon>().HasData(new Pokemon
|
||||||
|
{
|
||||||
|
Id = 23,
|
||||||
|
PokemonId = 37,
|
||||||
|
PokemonName = "Vulpix",
|
||||||
|
IsVariation = true,
|
||||||
|
VariationName = "Alolan",
|
||||||
|
SleepType = "Slumbering",
|
||||||
|
Speciality = "Berries"
|
||||||
|
|
||||||
|
});
|
||||||
|
modelBuilder.Entity<Pokemon>().HasData(new Pokemon
|
||||||
|
{
|
||||||
|
Id = 24,
|
||||||
|
PokemonId = 38,
|
||||||
|
PokemonName = "Ninetails",
|
||||||
|
IsVariation = true,
|
||||||
|
VariationName = "Alolan",
|
||||||
|
SleepType = "Slumbering",
|
||||||
|
Speciality = "Berries"
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,10 @@
|
||||||
using Microsoft.EntityFrameworkCore;
|
using AutoMapper;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Identity.Client;
|
|
||||||
using Portfolio.Application.Services.Articles;
|
using Portfolio.Application.Services.Articles;
|
||||||
using Portfolio.Application.Services.NWSWeatherService;
|
|
||||||
using Portfolio.Application.Services.PokemonService;
|
using Portfolio.Application.Services.PokemonService;
|
||||||
using Portfolio.Domain.Features.Pokemon;
|
using Portfolio.Domain.Features.Pokemon;
|
||||||
using Portfolio.Domain.Features.Pokemon_Natures;
|
|
||||||
using Portfolio.Domain.Features.Pokemon_Subskills;
|
|
||||||
using Portfolio.Infrastructure.Repositories;
|
using Portfolio.Infrastructure.Repositories;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
@ -21,13 +18,20 @@ namespace Portfolio.Infrastructure
|
||||||
{
|
{
|
||||||
public static IServiceCollection AddInfrastructure( this IServiceCollection services, IConfiguration configuration)
|
public static IServiceCollection AddInfrastructure( this IServiceCollection services, IConfiguration configuration)
|
||||||
{
|
{
|
||||||
|
IMapper mapper = MappingConfig.RegisterMaps().CreateMapper();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
services.AddDbContext<ApplicationDbContext>(options =>
|
services.AddDbContext<ApplicationDbContext>(options =>
|
||||||
options.UseSqlServer(configuration.GetConnectionString("DefaultConnection")
|
options.UseSqlServer(configuration.GetConnectionString("DefaultConnection")
|
||||||
));
|
));
|
||||||
|
|
||||||
services.AddScoped<IPokemonRepository, PokemonRepository>();
|
services.AddScoped<IPokemonRepository, PokemonRepository>();
|
||||||
services.AddScoped<IPokemonNatureRepository, PokemonNatureRepository>();
|
|
||||||
services.AddScoped<IPokemonSubskillRepository, PokemonSubskillRepository>();
|
|
||||||
//services.AddScoped<INWSWeatherService, NWSWeatherService>();
|
services.AddSingleton(mapper);
|
||||||
|
services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies());
|
||||||
|
|
||||||
|
|
||||||
return services;
|
return services;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
using AutoMapper;
|
||||||
|
using Portfolio.Domain.Features.Dtos;
|
||||||
|
using Portfolio.Domain.Features.Pokemon;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Net.NetworkInformation;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Portfolio.Infrastructure
|
||||||
|
{
|
||||||
|
public class MappingConfig
|
||||||
|
{
|
||||||
|
public static MapperConfiguration RegisterMaps()
|
||||||
|
{
|
||||||
|
var mappingConfig = new MapperConfiguration(config =>
|
||||||
|
{
|
||||||
|
config.CreateMap<PokemonDto, Pokemon>();
|
||||||
|
config.CreateMap<Pokemon, PokemonDto>();
|
||||||
|
});
|
||||||
|
return mappingConfig;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,335 @@
|
||||||
|
// <auto-generated />
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using Portfolio.Infrastructure;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Portfolio.Infrastructure.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(ApplicationDbContext))]
|
||||||
|
[Migration("20250217221142_AddPokemon")]
|
||||||
|
partial class AddPokemon
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "9.0.2")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||||
|
|
||||||
|
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity("Portfolio.Domain.Features.Pokemon.Pokemon", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<bool>("IsVariation")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
b.Property<int>("PokemonId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("PokemonName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("SleepType")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("Speciality")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("VariationName")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Pokemons");
|
||||||
|
|
||||||
|
b.HasData(
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 1,
|
||||||
|
IsVariation = false,
|
||||||
|
PokemonId = 1,
|
||||||
|
PokemonName = "Bulbasaur",
|
||||||
|
SleepType = "Dozing",
|
||||||
|
Speciality = "Ingredients"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 2,
|
||||||
|
IsVariation = false,
|
||||||
|
PokemonId = 2,
|
||||||
|
PokemonName = "Ivysaur",
|
||||||
|
SleepType = "Dozing",
|
||||||
|
Speciality = "Ingredients"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 3,
|
||||||
|
IsVariation = false,
|
||||||
|
PokemonId = 3,
|
||||||
|
PokemonName = "Venasaur",
|
||||||
|
SleepType = "Dozing",
|
||||||
|
Speciality = "Ingredients"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 4,
|
||||||
|
IsVariation = false,
|
||||||
|
PokemonId = 4,
|
||||||
|
PokemonName = "Charmander",
|
||||||
|
SleepType = "Snoozing",
|
||||||
|
Speciality = "Ingredients"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 5,
|
||||||
|
IsVariation = false,
|
||||||
|
PokemonId = 5,
|
||||||
|
PokemonName = "Charmeleon",
|
||||||
|
SleepType = "Snoozing",
|
||||||
|
Speciality = "Ingredients"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 6,
|
||||||
|
IsVariation = false,
|
||||||
|
PokemonId = 6,
|
||||||
|
PokemonName = "Charizard",
|
||||||
|
SleepType = "Snoozing",
|
||||||
|
Speciality = "Ingredients"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 7,
|
||||||
|
IsVariation = false,
|
||||||
|
PokemonId = 7,
|
||||||
|
PokemonName = "Squirtle",
|
||||||
|
SleepType = "Slumbering",
|
||||||
|
Speciality = "Ingredients"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 8,
|
||||||
|
IsVariation = false,
|
||||||
|
PokemonId = 8,
|
||||||
|
PokemonName = "Wartortle",
|
||||||
|
SleepType = "Slumbering",
|
||||||
|
Speciality = "Ingredients"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 9,
|
||||||
|
IsVariation = false,
|
||||||
|
PokemonId = 9,
|
||||||
|
PokemonName = "Blastoise",
|
||||||
|
SleepType = "Slumbering",
|
||||||
|
Speciality = "Ingredients"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 10,
|
||||||
|
IsVariation = false,
|
||||||
|
PokemonId = 10,
|
||||||
|
PokemonName = "Caterpie",
|
||||||
|
SleepType = "Dozing",
|
||||||
|
Speciality = "Berries"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 11,
|
||||||
|
IsVariation = false,
|
||||||
|
PokemonId = 11,
|
||||||
|
PokemonName = "Metapod",
|
||||||
|
SleepType = "Dozing",
|
||||||
|
Speciality = "Berries"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 12,
|
||||||
|
IsVariation = false,
|
||||||
|
PokemonId = 12,
|
||||||
|
PokemonName = "Butterfree",
|
||||||
|
SleepType = "Dozing",
|
||||||
|
Speciality = "Berries"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 13,
|
||||||
|
IsVariation = false,
|
||||||
|
PokemonId = 19,
|
||||||
|
PokemonName = "Rattata",
|
||||||
|
SleepType = "Snoozing",
|
||||||
|
Speciality = "Berries"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 14,
|
||||||
|
IsVariation = false,
|
||||||
|
PokemonId = 20,
|
||||||
|
PokemonName = "Raticate",
|
||||||
|
SleepType = "Snoozing",
|
||||||
|
Speciality = "Berries"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 15,
|
||||||
|
IsVariation = false,
|
||||||
|
PokemonId = 23,
|
||||||
|
PokemonName = "Ekans",
|
||||||
|
SleepType = "Dozing",
|
||||||
|
Speciality = "Berries"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 16,
|
||||||
|
IsVariation = false,
|
||||||
|
PokemonId = 24,
|
||||||
|
PokemonName = "Arbok",
|
||||||
|
SleepType = "Dozing",
|
||||||
|
Speciality = "Berries"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 17,
|
||||||
|
IsVariation = false,
|
||||||
|
PokemonId = 25,
|
||||||
|
PokemonName = "Pikachu",
|
||||||
|
SleepType = "Snoozing",
|
||||||
|
Speciality = "Berries"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 18,
|
||||||
|
IsVariation = false,
|
||||||
|
PokemonId = 26,
|
||||||
|
PokemonName = "Raticate",
|
||||||
|
SleepType = "Snoozing",
|
||||||
|
Speciality = "Berries"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 19,
|
||||||
|
IsVariation = false,
|
||||||
|
PokemonId = 35,
|
||||||
|
PokemonName = "Clefairy",
|
||||||
|
SleepType = "Snoozing",
|
||||||
|
Speciality = "Berries"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 20,
|
||||||
|
IsVariation = false,
|
||||||
|
PokemonId = 36,
|
||||||
|
PokemonName = "Clefable",
|
||||||
|
SleepType = "Snoozing",
|
||||||
|
Speciality = "Berries"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 21,
|
||||||
|
IsVariation = false,
|
||||||
|
PokemonId = 37,
|
||||||
|
PokemonName = "Vulpix",
|
||||||
|
SleepType = "Snoozing",
|
||||||
|
Speciality = "Berries"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 22,
|
||||||
|
IsVariation = false,
|
||||||
|
PokemonId = 38,
|
||||||
|
PokemonName = "Ninetails",
|
||||||
|
SleepType = "Snoozing",
|
||||||
|
Speciality = "Berries"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 23,
|
||||||
|
IsVariation = true,
|
||||||
|
PokemonId = 37,
|
||||||
|
PokemonName = "Vulpix",
|
||||||
|
SleepType = "Slumbering",
|
||||||
|
Speciality = "Berries",
|
||||||
|
VariationName = "Alolan"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 24,
|
||||||
|
IsVariation = true,
|
||||||
|
PokemonId = 38,
|
||||||
|
PokemonName = "Ninetails",
|
||||||
|
SleepType = "Slumbering",
|
||||||
|
Speciality = "Berries",
|
||||||
|
VariationName = "Alolan"
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Portfolio.Domain.Features.Pokemon_Natures.PokemonNatures", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("BerryRating")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("IngredientRating")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("Nature")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<int>("SkillRating")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("PokemonNatures");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Portfolio.Domain.Features.Pokemon_Subskills.PokemonSubskills", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("BerryRank")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("IngredientRank")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("SkillRank")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("SubSkill")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("PokemonSubskills");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,171 @@
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
|
||||||
|
|
||||||
|
namespace Portfolio.Infrastructure.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class AddPokemon : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.InsertData(
|
||||||
|
table: "Pokemons",
|
||||||
|
columns: new[] { "Id", "IsVariation", "PokemonId", "PokemonName", "SleepType", "Speciality", "VariationName" },
|
||||||
|
values: new object[,]
|
||||||
|
{
|
||||||
|
{ 1, false, 1, "Bulbasaur", "Dozing", "Ingredients", null },
|
||||||
|
{ 2, false, 2, "Ivysaur", "Dozing", "Ingredients", null },
|
||||||
|
{ 3, false, 3, "Venasaur", "Dozing", "Ingredients", null },
|
||||||
|
{ 4, false, 4, "Charmander", "Snoozing", "Ingredients", null },
|
||||||
|
{ 5, false, 5, "Charmeleon", "Snoozing", "Ingredients", null },
|
||||||
|
{ 6, false, 6, "Charizard", "Snoozing", "Ingredients", null },
|
||||||
|
{ 7, false, 7, "Squirtle", "Slumbering", "Ingredients", null },
|
||||||
|
{ 8, false, 8, "Wartortle", "Slumbering", "Ingredients", null },
|
||||||
|
{ 9, false, 9, "Blastoise", "Slumbering", "Ingredients", null },
|
||||||
|
{ 10, false, 10, "Caterpie", "Dozing", "Berries", null },
|
||||||
|
{ 11, false, 11, "Metapod", "Dozing", "Berries", null },
|
||||||
|
{ 12, false, 12, "Butterfree", "Dozing", "Berries", null },
|
||||||
|
{ 13, false, 19, "Rattata", "Snoozing", "Berries", null },
|
||||||
|
{ 14, false, 20, "Raticate", "Snoozing", "Berries", null },
|
||||||
|
{ 15, false, 23, "Ekans", "Dozing", "Berries", null },
|
||||||
|
{ 16, false, 24, "Arbok", "Dozing", "Berries", null },
|
||||||
|
{ 17, false, 25, "Pikachu", "Snoozing", "Berries", null },
|
||||||
|
{ 18, false, 26, "Raticate", "Snoozing", "Berries", null },
|
||||||
|
{ 19, false, 35, "Clefairy", "Snoozing", "Berries", null },
|
||||||
|
{ 20, false, 36, "Clefable", "Snoozing", "Berries", null },
|
||||||
|
{ 21, false, 37, "Vulpix", "Snoozing", "Berries", null },
|
||||||
|
{ 22, false, 38, "Ninetails", "Snoozing", "Berries", null },
|
||||||
|
{ 23, true, 37, "Vulpix", "Slumbering", "Berries", "Alolan" },
|
||||||
|
{ 24, true, 38, "Ninetails", "Slumbering", "Berries", "Alolan" }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DeleteData(
|
||||||
|
table: "Pokemons",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: 1);
|
||||||
|
|
||||||
|
migrationBuilder.DeleteData(
|
||||||
|
table: "Pokemons",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: 2);
|
||||||
|
|
||||||
|
migrationBuilder.DeleteData(
|
||||||
|
table: "Pokemons",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: 3);
|
||||||
|
|
||||||
|
migrationBuilder.DeleteData(
|
||||||
|
table: "Pokemons",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: 4);
|
||||||
|
|
||||||
|
migrationBuilder.DeleteData(
|
||||||
|
table: "Pokemons",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: 5);
|
||||||
|
|
||||||
|
migrationBuilder.DeleteData(
|
||||||
|
table: "Pokemons",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: 6);
|
||||||
|
|
||||||
|
migrationBuilder.DeleteData(
|
||||||
|
table: "Pokemons",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: 7);
|
||||||
|
|
||||||
|
migrationBuilder.DeleteData(
|
||||||
|
table: "Pokemons",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: 8);
|
||||||
|
|
||||||
|
migrationBuilder.DeleteData(
|
||||||
|
table: "Pokemons",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: 9);
|
||||||
|
|
||||||
|
migrationBuilder.DeleteData(
|
||||||
|
table: "Pokemons",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: 10);
|
||||||
|
|
||||||
|
migrationBuilder.DeleteData(
|
||||||
|
table: "Pokemons",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: 11);
|
||||||
|
|
||||||
|
migrationBuilder.DeleteData(
|
||||||
|
table: "Pokemons",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: 12);
|
||||||
|
|
||||||
|
migrationBuilder.DeleteData(
|
||||||
|
table: "Pokemons",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: 13);
|
||||||
|
|
||||||
|
migrationBuilder.DeleteData(
|
||||||
|
table: "Pokemons",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: 14);
|
||||||
|
|
||||||
|
migrationBuilder.DeleteData(
|
||||||
|
table: "Pokemons",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: 15);
|
||||||
|
|
||||||
|
migrationBuilder.DeleteData(
|
||||||
|
table: "Pokemons",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: 16);
|
||||||
|
|
||||||
|
migrationBuilder.DeleteData(
|
||||||
|
table: "Pokemons",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: 17);
|
||||||
|
|
||||||
|
migrationBuilder.DeleteData(
|
||||||
|
table: "Pokemons",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: 18);
|
||||||
|
|
||||||
|
migrationBuilder.DeleteData(
|
||||||
|
table: "Pokemons",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: 19);
|
||||||
|
|
||||||
|
migrationBuilder.DeleteData(
|
||||||
|
table: "Pokemons",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: 20);
|
||||||
|
|
||||||
|
migrationBuilder.DeleteData(
|
||||||
|
table: "Pokemons",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: 21);
|
||||||
|
|
||||||
|
migrationBuilder.DeleteData(
|
||||||
|
table: "Pokemons",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: 22);
|
||||||
|
|
||||||
|
migrationBuilder.DeleteData(
|
||||||
|
table: "Pokemons",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: 23);
|
||||||
|
|
||||||
|
migrationBuilder.DeleteData(
|
||||||
|
table: "Pokemons",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: 24);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,118 +0,0 @@
|
||||||
// <auto-generated />
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
||||||
using Microsoft.EntityFrameworkCore.Metadata;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
||||||
using Portfolio.Infrastructure;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace Portfolio.Infrastructure.Migrations
|
|
||||||
{
|
|
||||||
[DbContext(typeof(ApplicationDbContext))]
|
|
||||||
[Migration("20250321161454_AddPokemonImageUrl")]
|
|
||||||
partial class AddPokemonImageUrl
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|
||||||
{
|
|
||||||
#pragma warning disable 612, 618
|
|
||||||
modelBuilder
|
|
||||||
.HasAnnotation("ProductVersion", "9.0.2")
|
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
|
||||||
|
|
||||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
|
||||||
|
|
||||||
modelBuilder.Entity("Portfolio.Domain.Features.Pokemon.Pokemon", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<bool>("IsVariation")
|
|
||||||
.HasColumnType("bit");
|
|
||||||
|
|
||||||
b.Property<int>("PokemonId")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("PokemonImageUrl")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("PokemonName")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("SleepType")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Speciality")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("VariationName")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("Pokemons");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Portfolio.Domain.Features.Pokemon_Natures.PokemonNature", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<int>("BerryRating")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("IngredientRating")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("Nature")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<int>("SkillRating")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("PokemonNatures");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Portfolio.Domain.Features.Pokemon_Subskills.PokemonSubskill", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<int>("BerryRank")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("IngredientRank")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("SkillRank")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("SubSkill")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("PokemonSubskills");
|
|
||||||
});
|
|
||||||
#pragma warning restore 612, 618
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,28 +0,0 @@
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace Portfolio.Infrastructure.Migrations
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
public partial class AddPokemonImageUrl : Migration
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.AddColumn<string>(
|
|
||||||
name: "PokemonImageUrl",
|
|
||||||
table: "Pokemons",
|
|
||||||
type: "nvarchar(max)",
|
|
||||||
nullable: true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "PokemonImageUrl",
|
|
||||||
table: "Pokemons");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,121 +0,0 @@
|
||||||
// <auto-generated />
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
||||||
using Microsoft.EntityFrameworkCore.Metadata;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
||||||
using Portfolio.Infrastructure;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace Portfolio.Infrastructure.Migrations
|
|
||||||
{
|
|
||||||
[DbContext(typeof(ApplicationDbContext))]
|
|
||||||
[Migration("20250321165440_AddPokemonShinyImageUrl")]
|
|
||||||
partial class AddPokemonShinyImageUrl
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|
||||||
{
|
|
||||||
#pragma warning disable 612, 618
|
|
||||||
modelBuilder
|
|
||||||
.HasAnnotation("ProductVersion", "9.0.2")
|
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
|
||||||
|
|
||||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
|
||||||
|
|
||||||
modelBuilder.Entity("Portfolio.Domain.Features.Pokemon.Pokemon", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<bool>("IsVariation")
|
|
||||||
.HasColumnType("bit");
|
|
||||||
|
|
||||||
b.Property<int>("PokemonId")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("PokemonImageUrl")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("PokemonName")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("PokemonShinyImageUrl")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("SleepType")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Speciality")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("VariationName")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("Pokemons");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Portfolio.Domain.Features.Pokemon_Natures.PokemonNature", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<int>("BerryRating")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("IngredientRating")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("Nature")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<int>("SkillRating")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("PokemonNatures");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Portfolio.Domain.Features.Pokemon_Subskills.PokemonSubskill", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<int>("BerryRank")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("IngredientRank")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("SkillRank")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("SubSkill")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("PokemonSubskills");
|
|
||||||
});
|
|
||||||
#pragma warning restore 612, 618
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,28 +0,0 @@
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace Portfolio.Infrastructure.Migrations
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
public partial class AddPokemonShinyImageUrl : Migration
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.AddColumn<string>(
|
|
||||||
name: "PokemonShinyImageUrl",
|
|
||||||
table: "Pokemons",
|
|
||||||
type: "nvarchar(max)",
|
|
||||||
nullable: true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "PokemonShinyImageUrl",
|
|
||||||
table: "Pokemons");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,124 +0,0 @@
|
||||||
// <auto-generated />
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
||||||
using Microsoft.EntityFrameworkCore.Metadata;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
||||||
using Portfolio.Infrastructure;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace Portfolio.Infrastructure.Migrations
|
|
||||||
{
|
|
||||||
[DbContext(typeof(ApplicationDbContext))]
|
|
||||||
[Migration("20250404172651_include_pokemon_type")]
|
|
||||||
partial class include_pokemon_type
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|
||||||
{
|
|
||||||
#pragma warning disable 612, 618
|
|
||||||
modelBuilder
|
|
||||||
.HasAnnotation("ProductVersion", "9.0.2")
|
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
|
||||||
|
|
||||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
|
||||||
|
|
||||||
modelBuilder.Entity("Portfolio.Domain.Features.Pokemon.Pokemon", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<bool>("IsVariation")
|
|
||||||
.HasColumnType("bit");
|
|
||||||
|
|
||||||
b.Property<int>("PokemonId")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("PokemonImageUrl")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("PokemonName")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("PokemonShinyImageUrl")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("PokemonType")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("SleepType")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Speciality")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("VariationName")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("Pokemons");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Portfolio.Domain.Features.Pokemon_Natures.PokemonNature", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<int>("BerryRating")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("IngredientRating")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("Nature")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<int>("SkillRating")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("PokemonNatures");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Portfolio.Domain.Features.Pokemon_Subskills.PokemonSubskill", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<int>("BerryRank")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("IngredientRank")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("SkillRank")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("SubSkill")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("PokemonSubskills");
|
|
||||||
});
|
|
||||||
#pragma warning restore 612, 618
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,28 +0,0 @@
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace Portfolio.Infrastructure.Migrations
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
public partial class include_pokemon_type : Migration
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.AddColumn<string>(
|
|
||||||
name: "PokemonType",
|
|
||||||
table: "Pokemons",
|
|
||||||
type: "nvarchar(max)",
|
|
||||||
nullable: true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "PokemonType",
|
|
||||||
table: "Pokemons");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,127 +0,0 @@
|
||||||
// <auto-generated />
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
||||||
using Microsoft.EntityFrameworkCore.Metadata;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
||||||
using Portfolio.Infrastructure;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace Portfolio.Infrastructure.Migrations
|
|
||||||
{
|
|
||||||
[DbContext(typeof(ApplicationDbContext))]
|
|
||||||
[Migration("20250404173359_include_flavortext")]
|
|
||||||
partial class include_flavortext
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|
||||||
{
|
|
||||||
#pragma warning disable 612, 618
|
|
||||||
modelBuilder
|
|
||||||
.HasAnnotation("ProductVersion", "9.0.2")
|
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
|
||||||
|
|
||||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
|
||||||
|
|
||||||
modelBuilder.Entity("Portfolio.Domain.Features.Pokemon.Pokemon", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<string>("FlavorText")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<bool>("IsVariation")
|
|
||||||
.HasColumnType("bit");
|
|
||||||
|
|
||||||
b.Property<int>("PokemonId")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("PokemonImageUrl")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("PokemonName")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("PokemonShinyImageUrl")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("PokemonType")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("SleepType")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Speciality")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("VariationName")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("Pokemons");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Portfolio.Domain.Features.Pokemon_Natures.PokemonNature", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<int>("BerryRating")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("IngredientRating")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("Nature")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<int>("SkillRating")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("PokemonNatures");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Portfolio.Domain.Features.Pokemon_Subskills.PokemonSubskill", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<int>("BerryRank")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("IngredientRank")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("SkillRank")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("SubSkill")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("PokemonSubskills");
|
|
||||||
});
|
|
||||||
#pragma warning restore 612, 618
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,28 +0,0 @@
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace Portfolio.Infrastructure.Migrations
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
public partial class include_flavortext : Migration
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.AddColumn<string>(
|
|
||||||
name: "FlavorText",
|
|
||||||
table: "Pokemons",
|
|
||||||
type: "nvarchar(max)",
|
|
||||||
nullable: true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "FlavorText",
|
|
||||||
table: "Pokemons");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,130 +0,0 @@
|
||||||
// <auto-generated />
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
||||||
using Microsoft.EntityFrameworkCore.Metadata;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
||||||
using Portfolio.Infrastructure;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace Portfolio.Infrastructure.Migrations
|
|
||||||
{
|
|
||||||
[DbContext(typeof(ApplicationDbContext))]
|
|
||||||
[Migration("20251117160500_updatePokemonAddIngredients")]
|
|
||||||
partial class updatePokemonAddIngredients
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|
||||||
{
|
|
||||||
#pragma warning disable 612, 618
|
|
||||||
modelBuilder
|
|
||||||
.HasAnnotation("ProductVersion", "9.0.2")
|
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
|
||||||
|
|
||||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
|
||||||
|
|
||||||
modelBuilder.Entity("Portfolio.Domain.Features.Pokemon.Pokemon", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<string>("FlavorText")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.PrimitiveCollection<string>("Ingredients")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<bool>("IsVariation")
|
|
||||||
.HasColumnType("bit");
|
|
||||||
|
|
||||||
b.Property<int>("PokemonId")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("PokemonImageUrl")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("PokemonName")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("PokemonShinyImageUrl")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("PokemonType")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("SleepType")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Speciality")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("VariationName")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("Pokemons");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Portfolio.Domain.Features.Pokemon_Natures.PokemonNature", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<int>("BerryRating")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("IngredientRating")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("Nature")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<int>("SkillRating")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("PokemonNatures");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Portfolio.Domain.Features.Pokemon_Subskills.PokemonSubskill", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<int>("BerryRank")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("IngredientRank")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("SkillRank")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("SubSkill")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("PokemonSubskills");
|
|
||||||
});
|
|
||||||
#pragma warning restore 612, 618
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,28 +0,0 @@
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace Portfolio.Infrastructure.Migrations
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
public partial class updatePokemonAddIngredients : Migration
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.AddColumn<string>(
|
|
||||||
name: "Ingredients",
|
|
||||||
table: "Pokemons",
|
|
||||||
type: "nvarchar(max)",
|
|
||||||
nullable: true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "Ingredients",
|
|
||||||
table: "Pokemons");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,136 +0,0 @@
|
||||||
// <auto-generated />
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
||||||
using Microsoft.EntityFrameworkCore.Metadata;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
||||||
using Portfolio.Infrastructure;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace Portfolio.Infrastructure.Migrations
|
|
||||||
{
|
|
||||||
[DbContext(typeof(ApplicationDbContext))]
|
|
||||||
[Migration("20251117171147_updatePokemonChangeIngredient")]
|
|
||||||
partial class updatePokemonChangeIngredient
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|
||||||
{
|
|
||||||
#pragma warning disable 612, 618
|
|
||||||
modelBuilder
|
|
||||||
.HasAnnotation("ProductVersion", "9.0.2")
|
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
|
||||||
|
|
||||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
|
||||||
|
|
||||||
modelBuilder.Entity("Portfolio.Domain.Features.Pokemon.Pokemon", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<string>("FlavorText")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Ingredient1")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Ingredient2")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Ingredient3")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<bool>("IsVariation")
|
|
||||||
.HasColumnType("bit");
|
|
||||||
|
|
||||||
b.Property<int>("PokemonId")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("PokemonImageUrl")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("PokemonName")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("PokemonShinyImageUrl")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("PokemonType")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("SleepType")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Speciality")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("VariationName")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("Pokemons");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Portfolio.Domain.Features.Pokemon_Natures.PokemonNature", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<int>("BerryRating")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("IngredientRating")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("Nature")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<int>("SkillRating")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("PokemonNatures");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Portfolio.Domain.Features.Pokemon_Subskills.PokemonSubskill", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<int>("BerryRank")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("IngredientRank")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("SkillRank")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("SubSkill")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("PokemonSubskills");
|
|
||||||
});
|
|
||||||
#pragma warning restore 612, 618
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,48 +0,0 @@
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace Portfolio.Infrastructure.Migrations
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
public partial class updatePokemonChangeIngredient : Migration
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.RenameColumn(
|
|
||||||
name: "Ingredients",
|
|
||||||
table: "Pokemons",
|
|
||||||
newName: "Ingredient3");
|
|
||||||
|
|
||||||
migrationBuilder.AddColumn<string>(
|
|
||||||
name: "Ingredient1",
|
|
||||||
table: "Pokemons",
|
|
||||||
type: "nvarchar(max)",
|
|
||||||
nullable: true);
|
|
||||||
|
|
||||||
migrationBuilder.AddColumn<string>(
|
|
||||||
name: "Ingredient2",
|
|
||||||
table: "Pokemons",
|
|
||||||
type: "nvarchar(max)",
|
|
||||||
nullable: true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "Ingredient1",
|
|
||||||
table: "Pokemons");
|
|
||||||
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "Ingredient2",
|
|
||||||
table: "Pokemons");
|
|
||||||
|
|
||||||
migrationBuilder.RenameColumn(
|
|
||||||
name: "Ingredient3",
|
|
||||||
table: "Pokemons",
|
|
||||||
newName: "Ingredients");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,149 +0,0 @@
|
||||||
// <auto-generated />
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
||||||
using Microsoft.EntityFrameworkCore.Metadata;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
||||||
using Portfolio.Infrastructure;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace Portfolio.Infrastructure.Migrations
|
|
||||||
{
|
|
||||||
[DbContext(typeof(ApplicationDbContext))]
|
|
||||||
[Migration("20251205171834_updatePokemonAddBerry+Skill+SleepStyles")]
|
|
||||||
partial class updatePokemonAddBerrySkillSleepStyles
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|
||||||
{
|
|
||||||
#pragma warning disable 612, 618
|
|
||||||
modelBuilder
|
|
||||||
.HasAnnotation("ProductVersion", "9.0.2")
|
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
|
||||||
|
|
||||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
|
||||||
|
|
||||||
modelBuilder.Entity("Portfolio.Domain.Features.Pokemon.Pokemon", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<string>("FlavorText")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Ingredient1")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Ingredient2")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Ingredient3")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<bool>("IsVariation")
|
|
||||||
.HasColumnType("bit");
|
|
||||||
|
|
||||||
b.Property<string>("PokemonBerry")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<int>("PokemonId")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("PokemonImageUrl")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("PokemonName")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("PokemonShinyImageUrl")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.PrimitiveCollection<string>("PokemonSleepStyleImageUrls")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("PokemonType")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Skill")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("SkillDescription")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("SleepType")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Speciality")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("VariationName")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("Pokemons");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Portfolio.Domain.Features.Pokemon_Natures.PokemonNature", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<int>("BerryRating")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("IngredientRating")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("Nature")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<int>("SkillRating")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("PokemonNatures");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Portfolio.Domain.Features.Pokemon_Subskills.PokemonSubskill", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<int>("BerryRank")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("IngredientRank")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("SkillRank")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("SubSkill")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("PokemonSubskills");
|
|
||||||
});
|
|
||||||
#pragma warning restore 612, 618
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,76 +0,0 @@
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace Portfolio.Infrastructure.Migrations
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
public partial class updatePokemonAddBerrySkillSleepStyles : Migration
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.AlterColumn<string>(
|
|
||||||
name: "PokemonType",
|
|
||||||
table: "Pokemons",
|
|
||||||
type: "nvarchar(max)",
|
|
||||||
nullable: false,
|
|
||||||
defaultValue: "",
|
|
||||||
oldClrType: typeof(string),
|
|
||||||
oldType: "nvarchar(max)",
|
|
||||||
oldNullable: true);
|
|
||||||
|
|
||||||
migrationBuilder.AddColumn<string>(
|
|
||||||
name: "PokemonBerry",
|
|
||||||
table: "Pokemons",
|
|
||||||
type: "nvarchar(max)",
|
|
||||||
nullable: true);
|
|
||||||
|
|
||||||
migrationBuilder.AddColumn<string>(
|
|
||||||
name: "PokemonSleepStyleImageUrls",
|
|
||||||
table: "Pokemons",
|
|
||||||
type: "nvarchar(max)",
|
|
||||||
nullable: true);
|
|
||||||
|
|
||||||
migrationBuilder.AddColumn<string>(
|
|
||||||
name: "Skill",
|
|
||||||
table: "Pokemons",
|
|
||||||
type: "nvarchar(max)",
|
|
||||||
nullable: true);
|
|
||||||
|
|
||||||
migrationBuilder.AddColumn<string>(
|
|
||||||
name: "SkillDescription",
|
|
||||||
table: "Pokemons",
|
|
||||||
type: "nvarchar(max)",
|
|
||||||
nullable: true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "PokemonBerry",
|
|
||||||
table: "Pokemons");
|
|
||||||
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "PokemonSleepStyleImageUrls",
|
|
||||||
table: "Pokemons");
|
|
||||||
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "Skill",
|
|
||||||
table: "Pokemons");
|
|
||||||
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "SkillDescription",
|
|
||||||
table: "Pokemons");
|
|
||||||
|
|
||||||
migrationBuilder.AlterColumn<string>(
|
|
||||||
name: "PokemonType",
|
|
||||||
table: "Pokemons",
|
|
||||||
type: "nvarchar(max)",
|
|
||||||
nullable: true,
|
|
||||||
oldClrType: typeof(string),
|
|
||||||
oldType: "nvarchar(max)");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,146 +0,0 @@
|
||||||
// <auto-generated />
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
||||||
using Microsoft.EntityFrameworkCore.Metadata;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
||||||
using Portfolio.Infrastructure;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace Portfolio.Infrastructure.Migrations
|
|
||||||
{
|
|
||||||
[DbContext(typeof(ApplicationDbContext))]
|
|
||||||
[Migration("20251205172848_updatePokemonRemovedBerry")]
|
|
||||||
partial class updatePokemonRemovedBerry
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|
||||||
{
|
|
||||||
#pragma warning disable 612, 618
|
|
||||||
modelBuilder
|
|
||||||
.HasAnnotation("ProductVersion", "9.0.2")
|
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
|
||||||
|
|
||||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
|
||||||
|
|
||||||
modelBuilder.Entity("Portfolio.Domain.Features.Pokemon.Pokemon", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<string>("FlavorText")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Ingredient1")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Ingredient2")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Ingredient3")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<bool>("IsVariation")
|
|
||||||
.HasColumnType("bit");
|
|
||||||
|
|
||||||
b.Property<int>("PokemonId")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("PokemonImageUrl")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("PokemonName")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("PokemonShinyImageUrl")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.PrimitiveCollection<string>("PokemonSleepStyleImageUrls")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("PokemonType")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Skill")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("SkillDescription")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("SleepType")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Speciality")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("VariationName")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("Pokemons");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Portfolio.Domain.Features.Pokemon_Natures.PokemonNature", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<int>("BerryRating")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("IngredientRating")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("Nature")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<int>("SkillRating")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("PokemonNatures");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Portfolio.Domain.Features.Pokemon_Subskills.PokemonSubskill", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<int>("BerryRank")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("IngredientRank")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("SkillRank")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("SubSkill")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("PokemonSubskills");
|
|
||||||
});
|
|
||||||
#pragma warning restore 612, 618
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,28 +0,0 @@
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace Portfolio.Infrastructure.Migrations
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
public partial class updatePokemonRemovedBerry : Migration
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "PokemonBerry",
|
|
||||||
table: "Pokemons");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.AddColumn<string>(
|
|
||||||
name: "PokemonBerry",
|
|
||||||
table: "Pokemons",
|
|
||||||
type: "nvarchar(max)",
|
|
||||||
nullable: true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -29,47 +29,16 @@ namespace Portfolio.Infrastructure.Migrations
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
b.Property<string>("FlavorText")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Ingredient1")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Ingredient2")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Ingredient3")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<bool>("IsVariation")
|
b.Property<bool>("IsVariation")
|
||||||
.HasColumnType("bit");
|
.HasColumnType("bit");
|
||||||
|
|
||||||
b.Property<int>("PokemonId")
|
b.Property<int>("PokemonId")
|
||||||
.HasColumnType("int");
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.Property<string>("PokemonImageUrl")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("PokemonName")
|
b.Property<string>("PokemonName")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
b.Property<string>("PokemonShinyImageUrl")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.PrimitiveCollection<string>("PokemonSleepStyleImageUrls")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("PokemonType")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Skill")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("SkillDescription")
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("SleepType")
|
b.Property<string>("SleepType")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
@ -84,9 +53,229 @@ namespace Portfolio.Infrastructure.Migrations
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.ToTable("Pokemons");
|
b.ToTable("Pokemons");
|
||||||
|
|
||||||
|
b.HasData(
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 1,
|
||||||
|
IsVariation = false,
|
||||||
|
PokemonId = 1,
|
||||||
|
PokemonName = "Bulbasaur",
|
||||||
|
SleepType = "Dozing",
|
||||||
|
Speciality = "Ingredients"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 2,
|
||||||
|
IsVariation = false,
|
||||||
|
PokemonId = 2,
|
||||||
|
PokemonName = "Ivysaur",
|
||||||
|
SleepType = "Dozing",
|
||||||
|
Speciality = "Ingredients"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 3,
|
||||||
|
IsVariation = false,
|
||||||
|
PokemonId = 3,
|
||||||
|
PokemonName = "Venasaur",
|
||||||
|
SleepType = "Dozing",
|
||||||
|
Speciality = "Ingredients"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 4,
|
||||||
|
IsVariation = false,
|
||||||
|
PokemonId = 4,
|
||||||
|
PokemonName = "Charmander",
|
||||||
|
SleepType = "Snoozing",
|
||||||
|
Speciality = "Ingredients"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 5,
|
||||||
|
IsVariation = false,
|
||||||
|
PokemonId = 5,
|
||||||
|
PokemonName = "Charmeleon",
|
||||||
|
SleepType = "Snoozing",
|
||||||
|
Speciality = "Ingredients"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 6,
|
||||||
|
IsVariation = false,
|
||||||
|
PokemonId = 6,
|
||||||
|
PokemonName = "Charizard",
|
||||||
|
SleepType = "Snoozing",
|
||||||
|
Speciality = "Ingredients"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 7,
|
||||||
|
IsVariation = false,
|
||||||
|
PokemonId = 7,
|
||||||
|
PokemonName = "Squirtle",
|
||||||
|
SleepType = "Slumbering",
|
||||||
|
Speciality = "Ingredients"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 8,
|
||||||
|
IsVariation = false,
|
||||||
|
PokemonId = 8,
|
||||||
|
PokemonName = "Wartortle",
|
||||||
|
SleepType = "Slumbering",
|
||||||
|
Speciality = "Ingredients"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 9,
|
||||||
|
IsVariation = false,
|
||||||
|
PokemonId = 9,
|
||||||
|
PokemonName = "Blastoise",
|
||||||
|
SleepType = "Slumbering",
|
||||||
|
Speciality = "Ingredients"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 10,
|
||||||
|
IsVariation = false,
|
||||||
|
PokemonId = 10,
|
||||||
|
PokemonName = "Caterpie",
|
||||||
|
SleepType = "Dozing",
|
||||||
|
Speciality = "Berries"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 11,
|
||||||
|
IsVariation = false,
|
||||||
|
PokemonId = 11,
|
||||||
|
PokemonName = "Metapod",
|
||||||
|
SleepType = "Dozing",
|
||||||
|
Speciality = "Berries"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 12,
|
||||||
|
IsVariation = false,
|
||||||
|
PokemonId = 12,
|
||||||
|
PokemonName = "Butterfree",
|
||||||
|
SleepType = "Dozing",
|
||||||
|
Speciality = "Berries"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 13,
|
||||||
|
IsVariation = false,
|
||||||
|
PokemonId = 19,
|
||||||
|
PokemonName = "Rattata",
|
||||||
|
SleepType = "Snoozing",
|
||||||
|
Speciality = "Berries"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 14,
|
||||||
|
IsVariation = false,
|
||||||
|
PokemonId = 20,
|
||||||
|
PokemonName = "Raticate",
|
||||||
|
SleepType = "Snoozing",
|
||||||
|
Speciality = "Berries"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 15,
|
||||||
|
IsVariation = false,
|
||||||
|
PokemonId = 23,
|
||||||
|
PokemonName = "Ekans",
|
||||||
|
SleepType = "Dozing",
|
||||||
|
Speciality = "Berries"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 16,
|
||||||
|
IsVariation = false,
|
||||||
|
PokemonId = 24,
|
||||||
|
PokemonName = "Arbok",
|
||||||
|
SleepType = "Dozing",
|
||||||
|
Speciality = "Berries"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 17,
|
||||||
|
IsVariation = false,
|
||||||
|
PokemonId = 25,
|
||||||
|
PokemonName = "Pikachu",
|
||||||
|
SleepType = "Snoozing",
|
||||||
|
Speciality = "Berries"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 18,
|
||||||
|
IsVariation = false,
|
||||||
|
PokemonId = 26,
|
||||||
|
PokemonName = "Raticate",
|
||||||
|
SleepType = "Snoozing",
|
||||||
|
Speciality = "Berries"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 19,
|
||||||
|
IsVariation = false,
|
||||||
|
PokemonId = 35,
|
||||||
|
PokemonName = "Clefairy",
|
||||||
|
SleepType = "Snoozing",
|
||||||
|
Speciality = "Berries"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 20,
|
||||||
|
IsVariation = false,
|
||||||
|
PokemonId = 36,
|
||||||
|
PokemonName = "Clefable",
|
||||||
|
SleepType = "Snoozing",
|
||||||
|
Speciality = "Berries"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 21,
|
||||||
|
IsVariation = false,
|
||||||
|
PokemonId = 37,
|
||||||
|
PokemonName = "Vulpix",
|
||||||
|
SleepType = "Snoozing",
|
||||||
|
Speciality = "Berries"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 22,
|
||||||
|
IsVariation = false,
|
||||||
|
PokemonId = 38,
|
||||||
|
PokemonName = "Ninetails",
|
||||||
|
SleepType = "Snoozing",
|
||||||
|
Speciality = "Berries"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 23,
|
||||||
|
IsVariation = true,
|
||||||
|
PokemonId = 37,
|
||||||
|
PokemonName = "Vulpix",
|
||||||
|
SleepType = "Slumbering",
|
||||||
|
Speciality = "Berries",
|
||||||
|
VariationName = "Alolan"
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
Id = 24,
|
||||||
|
IsVariation = true,
|
||||||
|
PokemonId = 38,
|
||||||
|
PokemonName = "Ninetails",
|
||||||
|
SleepType = "Slumbering",
|
||||||
|
Speciality = "Berries",
|
||||||
|
VariationName = "Alolan"
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Portfolio.Domain.Features.Pokemon_Natures.PokemonNature", b =>
|
modelBuilder.Entity("Portfolio.Domain.Features.Pokemon_Natures.PokemonNatures", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
|
|
@ -112,7 +301,7 @@ namespace Portfolio.Infrastructure.Migrations
|
||||||
b.ToTable("PokemonNatures");
|
b.ToTable("PokemonNatures");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Portfolio.Domain.Features.Pokemon_Subskills.PokemonSubskill", b =>
|
modelBuilder.Entity("Portfolio.Domain.Features.Pokemon_Subskills.PokemonSubskills", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="AutoMapper" Version="14.0.0" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.2" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.2" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.2" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.2" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.2">
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.2">
|
||||||
|
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
|
|
||||||
|
|
||||||
To Update Entites in the Database:
|
|
||||||
|
|
||||||
1. Make necessary changes to Enttities within .Domain
|
|
||||||
2. Open NuGet Packet Manager
|
|
||||||
3. Ensure default project is pointed to .Infrastructure
|
|
||||||
4. Enter `Add-Migration [Migration Tag Name, ex: updateEntityAddChange]`
|
|
||||||
5. Enter `Update-Database`
|
|
||||||
6. Check SSMS to ensure changes.
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Portfolio.Domain.Features.Pokemon_Natures;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Portfolio.Infrastructure.Repositories
|
|
||||||
{
|
|
||||||
public class PokemonNatureRepository : IPokemonNatureRepository
|
|
||||||
{
|
|
||||||
private readonly ApplicationDbContext _context;
|
|
||||||
|
|
||||||
public PokemonNatureRepository(ApplicationDbContext context)
|
|
||||||
{
|
|
||||||
_context = context;
|
|
||||||
}
|
|
||||||
public async Task<List<PokemonNature>> GetAllPokemonNaturesAsync()
|
|
||||||
{
|
|
||||||
return await _context.PokemonNatures.ToListAsync();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,5 +1,10 @@
|
||||||
using Microsoft.EntityFrameworkCore;
|
using AutoMapper;
|
||||||
|
using Azure;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Portfolio.Application.Services;
|
||||||
|
using Portfolio.Domain.Features.Dtos;
|
||||||
using Portfolio.Domain.Features.Pokemon;
|
using Portfolio.Domain.Features.Pokemon;
|
||||||
|
using Portfolio.Domain.Utility;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
@ -11,106 +16,40 @@ namespace Portfolio.Infrastructure.Repositories
|
||||||
public class PokemonRepository : IPokemonRepository
|
public class PokemonRepository : IPokemonRepository
|
||||||
{
|
{
|
||||||
private readonly ApplicationDbContext _context;
|
private readonly ApplicationDbContext _context;
|
||||||
|
private readonly IBaseService _baseService;
|
||||||
|
private ResponseDto _response;
|
||||||
|
private IMapper _mapper;
|
||||||
|
|
||||||
public PokemonRepository(ApplicationDbContext context)
|
public PokemonRepository(ApplicationDbContext context, IMapper mapper, IBaseService baseService)
|
||||||
{
|
{
|
||||||
_context = context;
|
_context = context;
|
||||||
|
_baseService = baseService;
|
||||||
|
_mapper = mapper;
|
||||||
|
_response = new ResponseDto();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<List<Pokemon>> GetAllPokemonsAsync()
|
|
||||||
|
public async Task<ResponseDto> GetAllPokemon()
|
||||||
{
|
{
|
||||||
return await _context.Pokemons.ToListAsync();
|
return await _baseService.SendAsync(new RequestDto()
|
||||||
}
|
|
||||||
public async Task<Pokemon> GetPokemonByPokemonIdAsync(int id)
|
|
||||||
{
|
|
||||||
return await _context.Pokemons.FirstOrDefaultAsync(p => p.PokemonId == id);
|
|
||||||
}
|
|
||||||
public async Task<Pokemon> GetPokemonByIdAsync(int id)
|
|
||||||
{
|
|
||||||
return await _context.Pokemons.FirstOrDefaultAsync(p => p.Id == id);
|
|
||||||
}
|
|
||||||
public async Task AddPokemonAsync(Pokemon pokemon)
|
|
||||||
{
|
|
||||||
_context.Pokemons.Add(pokemon);
|
|
||||||
await _context.SaveChangesAsync();
|
|
||||||
}
|
|
||||||
public async Task DeletePokemonAsync(int pokemonId)
|
|
||||||
{
|
|
||||||
var pokemon = await _context.Pokemons.FindAsync(pokemonId);
|
|
||||||
if (pokemon != null)
|
|
||||||
{
|
{
|
||||||
_context.Pokemons.Remove(pokemon);
|
ApiType = StaticDetails.ApiType.GET,
|
||||||
await _context.SaveChangesAsync();
|
Url = StaticDetails.PokemonSleepAPIBase + "/api/pokemon"
|
||||||
}
|
});
|
||||||
|
//try
|
||||||
|
//{
|
||||||
|
// IEnumerable<Pokemon> objList = _context.Pokemons.ToList();
|
||||||
|
// _response.IsSuccess = true;
|
||||||
|
// _response.Message = "All Pokemon found.";
|
||||||
|
// _response.Result = _mapper.Map<IEnumerable<PokemonDto>>(objList);
|
||||||
|
//}
|
||||||
|
//catch (Exception ex)
|
||||||
|
//{
|
||||||
|
// _response.IsSuccess = false;
|
||||||
|
// _response.Message = ex.Message;
|
||||||
|
//}
|
||||||
|
//return _response;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task UpdatePokemonAsync(Pokemon pokemon)
|
|
||||||
{
|
|
||||||
_context.Pokemons.Update(pokemon);
|
|
||||||
await _context.SaveChangesAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<int?> GetPreviousPokemonIdAsync(int currentPokemonId)
|
|
||||||
{
|
|
||||||
// Get the previous Pokémon's PokemonId
|
|
||||||
var prevPokemonId = await _context.Pokemons
|
|
||||||
.Where(p => p.PokemonId < currentPokemonId)
|
|
||||||
.OrderByDescending(p => p.PokemonId)
|
|
||||||
.Select(p => (int?)p.PokemonId)
|
|
||||||
.FirstOrDefaultAsync();
|
|
||||||
|
|
||||||
// If no previous PokemonId is found, wrap around to the last one
|
|
||||||
if (prevPokemonId == null)
|
|
||||||
{
|
|
||||||
prevPokemonId = await _context.Pokemons
|
|
||||||
.OrderByDescending(p => p.PokemonId) // Get the last PokemonId
|
|
||||||
.Select(p => (int?)p.PokemonId)
|
|
||||||
.FirstOrDefaultAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
return prevPokemonId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<int?> GetNextPokemonIdAsync(int currentPokemonId)
|
|
||||||
{
|
|
||||||
// Get the next Pokémon's PokemonId
|
|
||||||
var nextPokemonId = await _context.Pokemons
|
|
||||||
.Where(p => p.PokemonId > currentPokemonId)
|
|
||||||
.OrderBy(p => p.PokemonId)
|
|
||||||
.Select(p => (int?)p.PokemonId)
|
|
||||||
.FirstOrDefaultAsync();
|
|
||||||
|
|
||||||
// If no next PokemonId is found, wrap around to the first one
|
|
||||||
if (nextPokemonId == null)
|
|
||||||
{
|
|
||||||
nextPokemonId = await _context.Pokemons
|
|
||||||
.OrderBy(p => p.PokemonId) // Get the first PokemonId
|
|
||||||
.Select(p => (int?)p.PokemonId)
|
|
||||||
.FirstOrDefaultAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
return nextPokemonId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<List<int>> GetAllPokemonIdsAsync()
|
|
||||||
{
|
|
||||||
return await _context.Pokemons
|
|
||||||
.OrderBy(p => p.PokemonId) // Ensure it's ordered by PokemonId
|
|
||||||
.Select(p => p.PokemonId)
|
|
||||||
.ToListAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<int?> GetVariationPokemonIdAsync(int pokemonId)
|
|
||||||
{
|
|
||||||
// Find a variation for the given PokemonId (where IsVariation is true)
|
|
||||||
var variation = await _context.Pokemons
|
|
||||||
.Where(p => p.PokemonId == pokemonId && p.IsVariation)
|
|
||||||
.FirstOrDefaultAsync();
|
|
||||||
|
|
||||||
// Return the Id of the variation, or null if no variation is found
|
|
||||||
return variation?.Id;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Portfolio.Domain.Features.Pokemon_Subskills;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Portfolio.Infrastructure.Repositories
|
|
||||||
{
|
|
||||||
public class PokemonSubskillRepository : IPokemonSubskillRepository
|
|
||||||
{
|
|
||||||
private readonly ApplicationDbContext _context;
|
|
||||||
|
|
||||||
public PokemonSubskillRepository(ApplicationDbContext context)
|
|
||||||
{
|
|
||||||
_context = context;
|
|
||||||
}
|
|
||||||
public async Task<List<PokemonSubskill>> GetAllPokemonSubskillsAsync()
|
|
||||||
{
|
|
||||||
return await _context.PokemonSubskills.ToListAsync();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,22 +1,21 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en" class="">
|
<html lang="en">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<base href="/" />
|
<base href="/" />
|
||||||
|
|
||||||
<link rel="stylesheet" href="bootstrap/bootstrap-pulse.css" /> <!-- app.css -->
|
<link rel="stylesheet" href="bootstrap/bootstrap-cosmo.css" /> <!-- app.css -->
|
||||||
<link rel="stylesheet" href="Portfolio.WebUI.Server.styles.css" />
|
<link rel="stylesheet" href="Portfolio.WebUI.Server.styles.css" />
|
||||||
|
|
||||||
<link rel="icon" type="image/png" href="favicon.png" />
|
<link rel="icon" type="image/png" href="favicon.png" />
|
||||||
<HeadOutlet />
|
<HeadOutlet />
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body class="bg-primary-subtle">
|
<body>
|
||||||
<Routes />
|
<Routes />
|
||||||
<script src="_framework/blazor.web.js"></script>
|
<script src="_framework/blazor.web.js"></script>
|
||||||
<script src="js/site.js"></script>
|
</body>
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
|
|
@ -1,34 +0,0 @@
|
||||||
@attribute [StreamRendering]
|
|
||||||
@rendermode InteractiveServer
|
|
||||||
|
|
||||||
<div class="pt-4">
|
|
||||||
@if (TemperatureDays is null || TemperatureRanges is null)
|
|
||||||
{
|
|
||||||
<Loading />
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
<div class="container">
|
|
||||||
<h3 class="text-xl font-bold mb-4 mt-4">Temperature Blanket Visualizer</h3>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-10">
|
|
||||||
<div class="d-flex">
|
|
||||||
<div class="temperature-blanket">
|
|
||||||
@foreach (var day in TemperatureDays)
|
|
||||||
{
|
|
||||||
var color = GetColorForTemp(day.AvgTemp);
|
|
||||||
<div style="width: 6px; height: 600px; background-color:@color; margin-right: 1px;"
|
|
||||||
title="@day.Date.ToString("MMM dd") - @day.AvgTemp°F (@color)">
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col d-flex align-items-center">
|
|
||||||
<TemperatureRangeEditor TempRanges="@TemperatureRanges" OnRangesChanged="HandleRangesChanged" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
@ -1,46 +0,0 @@
|
||||||
using Microsoft.AspNetCore.Components;
|
|
||||||
using Portfolio.Domain.Features.TemperatureDay;
|
|
||||||
using Portfolio.Domain.Features.TemperatureRange;
|
|
||||||
|
|
||||||
namespace Portfolio.WebUI.Server.Components.Component.Crochet_Components
|
|
||||||
{
|
|
||||||
public partial class TemperatureBlanketVisualizer : ComponentBase
|
|
||||||
{
|
|
||||||
[Parameter] public List<TemperatureDay> TemperatureDays { get; set; }
|
|
||||||
|
|
||||||
public List<TemperatureRange> TemperatureRanges { get; set; } = new();
|
|
||||||
|
|
||||||
protected override void OnInitialized()
|
|
||||||
{
|
|
||||||
TemperatureRanges = new()
|
|
||||||
{
|
|
||||||
new() { Min = 0, Max = 21, Color = "#ffffff" },
|
|
||||||
new() { Min = 21, Max = 28, Color = "#ffc0cb" },
|
|
||||||
new() { Min = 28, Max = 35, Color = "#dda0dd" },
|
|
||||||
new() { Min = 35, Max = 42, Color = "#add8e6" },
|
|
||||||
new() { Min = 42, Max = 49, Color = "#00008b" },
|
|
||||||
new() { Min = 49, Max = 56, Color = "#006400" },
|
|
||||||
new() { Min = 56, Max = 63, Color = "#07ed07" },
|
|
||||||
new() { Min = 63, Max = 70, Color = "#ffff00" },
|
|
||||||
new() { Min = 70, Max = 77, Color = "#ffa500" },
|
|
||||||
new() { Min = 77, Max = 84, Color = "#ff0000" },
|
|
||||||
new() { Min = 84, Max = 100, Color = "#000000" }
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private string GetColorForTemp(double temp)
|
|
||||||
{
|
|
||||||
var range = TemperatureRanges.FirstOrDefault(r => temp >= r.Min && temp < r.Max);
|
|
||||||
return range?.Color ?? "#888888";
|
|
||||||
}
|
|
||||||
|
|
||||||
private void HandleRangesChanged(List<TemperatureRange> updatedRanges)
|
|
||||||
{
|
|
||||||
TemperatureRanges = updatedRanges;
|
|
||||||
StateHasChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
body {
|
|
||||||
}
|
|
||||||
|
|
||||||
.temperature-blanket {
|
|
||||||
display: flex;
|
|
||||||
overflow-x: auto;
|
|
||||||
background-color: black;
|
|
||||||
padding: 10px;
|
|
||||||
}
|
|
||||||
|
|
@ -1,93 +0,0 @@
|
||||||
@using Microsoft.AspNetCore.Components.Web
|
|
||||||
|
|
||||||
|
|
||||||
@attribute [StreamRendering]
|
|
||||||
@rendermode InteractiveServer
|
|
||||||
|
|
||||||
<div class="container" > @* @onmouseup="OnMouseUp" @onmousemove="OnMouseMove" *@
|
|
||||||
<!-- Base number line -->
|
|
||||||
@* <div class="absolute top-1/2 left-0 right-0 h-1 bg-gray-300 transform -translate-y-1/2"></div> *@
|
|
||||||
|
|
||||||
@* <!-- Draggable nodes for adjusting range breakpoints -->
|
|
||||||
@for (int i = 0; i < TempRanges.Count; i++)
|
|
||||||
{
|
|
||||||
var left = i == 0 ? 0 : TempRanges[i - 1].Max;
|
|
||||||
var leftPercent = (left / 100.0) * 100;
|
|
||||||
|
|
||||||
<div class="absolute top-1/2 transform -translate-y-1/2 -translate-x-1/2 w-4 h-4 rounded-full bg-blue-600 cursor-pointer"
|
|
||||||
style="left: @leftPercent%"
|
|
||||||
@onmousedown="(e) => OnMouseDown(i, e)"
|
|
||||||
title="@left°F">
|
|
||||||
</div>
|
|
||||||
} *@
|
|
||||||
|
|
||||||
<!-- Color pickers for each range -->
|
|
||||||
<div class="card rounded-3">
|
|
||||||
<div class="card-header mb-3 text-center fw-bold">
|
|
||||||
Temperature Blanket Colors
|
|
||||||
</div>
|
|
||||||
|
|
||||||
@for (int i = 0; i < TempRanges.Count; i++)
|
|
||||||
{
|
|
||||||
var localIndex = i;
|
|
||||||
@* if (i == 0)
|
|
||||||
{
|
|
||||||
<div class="row align-items-center mb-2">
|
|
||||||
<div class="col-6 text-end pe-2">
|
|
||||||
<label class="form-label mb-0">
|
|
||||||
@TempRanges[i].Max°
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<div class="col-6 ps-2">
|
|
||||||
<input type="color"
|
|
||||||
value="@TempRanges[i].Color"
|
|
||||||
@onchange="e => HandleColorChange(e, localIndex)" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
else if (i == 10)
|
|
||||||
{
|
|
||||||
<div class="row align-items-center mb-2">
|
|
||||||
<div class="col-6 text-end pe-2">
|
|
||||||
<label class="form-label mb-0">
|
|
||||||
@TempRanges[i].Min° +
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<div class="col-6 ps-2">
|
|
||||||
<input type="color"
|
|
||||||
value="@TempRanges[i].Color"
|
|
||||||
@onchange="e => HandleColorChange(e, localIndex)" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
<div class="row align-items-center mb-2">
|
|
||||||
<div class="col-6 text-end pe-2">
|
|
||||||
<label class="form-label mb-0">
|
|
||||||
@TempRanges[i].Min° – @TempRanges[i].Max°
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<div class="col-6 ps-2">
|
|
||||||
<input type="color"
|
|
||||||
value="@TempRanges[i].Color"
|
|
||||||
@onchange="e => HandleColorChange(e, localIndex)" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
} *@
|
|
||||||
|
|
||||||
<div class="row align-items-center mb-2 ms-1">
|
|
||||||
<div class="col-6 text-end pe-2">
|
|
||||||
<label class="form-label mb-0 text-nowrap">
|
|
||||||
@TempRanges[i].Min° – @TempRanges[i].Max°
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<div class="col-6 ps-2">
|
|
||||||
<input type="color"
|
|
||||||
value="@TempRanges[i].Color"
|
|
||||||
@onchange="e => HandleColorChange(e, localIndex)" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
@ -1,88 +0,0 @@
|
||||||
using Microsoft.AspNetCore.Components.Web;
|
|
||||||
using Microsoft.AspNetCore.Components;
|
|
||||||
using Microsoft.JSInterop;
|
|
||||||
using Portfolio.Domain.Features.TemperatureRange;
|
|
||||||
|
|
||||||
namespace Portfolio.WebUI.Server.Components.Component.Crochet_Components
|
|
||||||
{
|
|
||||||
public partial class TemperatureRangeEditor : ComponentBase
|
|
||||||
{
|
|
||||||
[Parameter] public List<TemperatureRange> TempRanges { get; set; }
|
|
||||||
|
|
||||||
[Parameter] public EventCallback<List<TemperatureRange>> OnRangesChanged { get; set; }
|
|
||||||
|
|
||||||
[Inject] private IJSRuntime JS { get; set; }
|
|
||||||
|
|
||||||
private double windowWidth = 1000;
|
|
||||||
private int? draggingIndex = null;
|
|
||||||
|
|
||||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
|
||||||
{
|
|
||||||
if (firstRender)
|
|
||||||
{
|
|
||||||
windowWidth = await JS.InvokeAsync<double>("eval", "window.innerWidth");
|
|
||||||
StateHasChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnMouseDown(int index, MouseEventArgs e)
|
|
||||||
{
|
|
||||||
draggingIndex = index;
|
|
||||||
}
|
|
||||||
|
|
||||||
private async void OnMouseUp()
|
|
||||||
{
|
|
||||||
if (draggingIndex != null)
|
|
||||||
{
|
|
||||||
draggingIndex = null;
|
|
||||||
await OnRangesChanged.InvokeAsync(TempRanges);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnMouseMove(MouseEventArgs e)
|
|
||||||
{
|
|
||||||
if (draggingIndex is not int index || index <= 0 || index >= TempRanges.Count)
|
|
||||||
return;
|
|
||||||
|
|
||||||
var percent = (e.ClientX / windowWidth) * 100;
|
|
||||||
percent = Math.Clamp(percent, 0, 100);
|
|
||||||
|
|
||||||
var min = TempRanges[index - 1].Min;
|
|
||||||
var max = TempRanges[index].Max;
|
|
||||||
|
|
||||||
if (percent <= min + 1 || percent >= max - 1)
|
|
||||||
return;
|
|
||||||
|
|
||||||
TempRanges[index - 1].Max = percent;
|
|
||||||
TempRanges[index].Min = percent;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void HandleColorChange(ChangeEventArgs e, int index)
|
|
||||||
{
|
|
||||||
if (index < 0 || index >= TempRanges.Count)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"Color change requested for out-of-bounds index: {index}");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var color = e?.Value?.ToString() ?? "#000000";
|
|
||||||
OnColorChanged(index, color);
|
|
||||||
}
|
|
||||||
|
|
||||||
private async void OnColorChanged(int index, string newColor)
|
|
||||||
{
|
|
||||||
//Console.WriteLine($"Color change at index {index} to {newColor}");
|
|
||||||
|
|
||||||
if (index >= 0 && index < TempRanges.Count)
|
|
||||||
{
|
|
||||||
TempRanges[index].Color = newColor;
|
|
||||||
Console.WriteLine($"Updated color: {TempRanges[index].Color}");
|
|
||||||
await OnRangesChanged.InvokeAsync(TempRanges);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Console.WriteLine($"Invalid index: {index} (Count: {TempRanges.Count})");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
input[type="color"] {
|
|
||||||
width: 2.5rem;
|
|
||||||
height: 2rem;
|
|
||||||
padding: 0;
|
|
||||||
border: none;
|
|
||||||
}
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
<!--
|
|
||||||
https://codepen.io/dissimulate/pen/nmJyyg
|
|
||||||
-->
|
|
||||||
<div id="load">
|
|
||||||
<div>G</div>
|
|
||||||
<div>N</div>
|
|
||||||
<div>I</div>
|
|
||||||
<div>D</div>
|
|
||||||
<div>A</div>
|
|
||||||
<div>O</div>
|
|
||||||
<div>L</div>
|
|
||||||
</div>
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
using Microsoft.AspNetCore.Components;
|
|
||||||
|
|
||||||
namespace Portfolio.WebUI.Server.Components.Component
|
|
||||||
{
|
|
||||||
public partial class Loading
|
|
||||||
{
|
|
||||||
[Parameter]
|
|
||||||
public string LoadingString { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,195 +0,0 @@
|
||||||
body {
|
|
||||||
background: #000;
|
|
||||||
}
|
|
||||||
|
|
||||||
#load {
|
|
||||||
position: absolute;
|
|
||||||
width: 600px;
|
|
||||||
height: 36px;
|
|
||||||
left: 50%;
|
|
||||||
top: 40%;
|
|
||||||
margin-left: -300px;
|
|
||||||
overflow: visible;
|
|
||||||
-webkit-user-select: none;
|
|
||||||
-moz-user-select: none;
|
|
||||||
-ms-user-select: none;
|
|
||||||
user-select: none;
|
|
||||||
cursor: default;
|
|
||||||
}
|
|
||||||
|
|
||||||
#load div {
|
|
||||||
position: absolute;
|
|
||||||
width: 20px;
|
|
||||||
height: 36px;
|
|
||||||
opacity: 0;
|
|
||||||
font-family: Helvetica, Arial, sans-serif;
|
|
||||||
animation: move 3s linear infinite;
|
|
||||||
-o-animation: move 3s linear infinite;
|
|
||||||
-moz-animation: move 3s linear infinite;
|
|
||||||
-webkit-animation: move 3s linear infinite;
|
|
||||||
transform: rotate(180deg);
|
|
||||||
-o-transform: rotate(180deg);
|
|
||||||
-moz-transform: rotate(180deg);
|
|
||||||
-webkit-transform: rotate(180deg);
|
|
||||||
color: #35C4F0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#load div:nth-child(2) {
|
|
||||||
animation-delay: 0.2s;
|
|
||||||
-o-animation-delay: 0.2s;
|
|
||||||
-moz-animation-delay: 0.2s;
|
|
||||||
-webkit-animation-delay: 0.2s;
|
|
||||||
}
|
|
||||||
|
|
||||||
#load div:nth-child(3) {
|
|
||||||
animation-delay: 0.4s;
|
|
||||||
-o-animation-delay: 0.4s;
|
|
||||||
-webkit-animation-delay: 0.4s;
|
|
||||||
-webkit-animation-delay: 0.4s;
|
|
||||||
}
|
|
||||||
|
|
||||||
#load div:nth-child(4) {
|
|
||||||
animation-delay: 0.6s;
|
|
||||||
-o-animation-delay: 0.6s;
|
|
||||||
-moz-animation-delay: 0.6s;
|
|
||||||
-webkit-animation-delay: 0.6s;
|
|
||||||
}
|
|
||||||
|
|
||||||
#load div:nth-child(5) {
|
|
||||||
animation-delay: 0.8s;
|
|
||||||
-o-animation-delay: 0.8s;
|
|
||||||
-moz-animation-delay: 0.8s;
|
|
||||||
-webkit-animation-delay: 0.8s;
|
|
||||||
}
|
|
||||||
|
|
||||||
#load div:nth-child(6) {
|
|
||||||
animation-delay: 1s;
|
|
||||||
-o-animation-delay: 1s;
|
|
||||||
-moz-animation-delay: 1s;
|
|
||||||
-webkit-animation-delay: 1s;
|
|
||||||
}
|
|
||||||
|
|
||||||
#load div:nth-child(7) {
|
|
||||||
animation-delay: 1.2s;
|
|
||||||
-o-animation-delay: 1.2s;
|
|
||||||
-moz-animation-delay: 1.2s;
|
|
||||||
-webkit-animation-delay: 1.2s;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes move {
|
|
||||||
0% {
|
|
||||||
left: 0;
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
35% {
|
|
||||||
left: 41%;
|
|
||||||
-moz-transform: rotate(0deg);
|
|
||||||
-webkit-transform: rotate(0deg);
|
|
||||||
-o-transform: rotate(0deg);
|
|
||||||
transform: rotate(0deg);
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
65% {
|
|
||||||
left: 59%;
|
|
||||||
-moz-transform: rotate(0deg);
|
|
||||||
-webkit-transform: rotate(0deg);
|
|
||||||
-o-transform: rotate(0deg);
|
|
||||||
transform: rotate(0deg);
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
100% {
|
|
||||||
left: 100%;
|
|
||||||
-moz-transform: rotate(-180deg);
|
|
||||||
-webkit-transform: rotate(-180deg);
|
|
||||||
-o-transform: rotate(-180deg);
|
|
||||||
transform: rotate(-180deg);
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@-moz-keyframes move {
|
|
||||||
0% {
|
|
||||||
left: 0;
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
35% {
|
|
||||||
left: 41%;
|
|
||||||
-moz-transform: rotate(0deg);
|
|
||||||
transform: rotate(0deg);
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
65% {
|
|
||||||
left: 59%;
|
|
||||||
-moz-transform: rotate(0deg);
|
|
||||||
transform: rotate(0deg);
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
100% {
|
|
||||||
left: 100%;
|
|
||||||
-moz-transform: rotate(-180deg);
|
|
||||||
transform: rotate(-180deg);
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@-webkit-keyframes move {
|
|
||||||
0% {
|
|
||||||
left: 0;
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
35% {
|
|
||||||
left: 41%;
|
|
||||||
-webkit-transform: rotate(0deg);
|
|
||||||
transform: rotate(0deg);
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
65% {
|
|
||||||
left: 59%;
|
|
||||||
-webkit-transform: rotate(0deg);
|
|
||||||
transform: rotate(0deg);
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
100% {
|
|
||||||
left: 100%;
|
|
||||||
-webkit-transform: rotate(-180deg);
|
|
||||||
transform: rotate(-180deg);
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@-o-keyframes move {
|
|
||||||
0% {
|
|
||||||
left: 0;
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
35% {
|
|
||||||
left: 41%;
|
|
||||||
-o-transform: rotate(0deg);
|
|
||||||
transform: rotate(0deg);
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
65% {
|
|
||||||
left: 59%;
|
|
||||||
-o-transform: rotate(0deg);
|
|
||||||
transform: rotate(0deg);
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
100% {
|
|
||||||
left: 100%;
|
|
||||||
-o-transform: rotate(-180deg);
|
|
||||||
transform: rotate(-180deg);
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
<div class="add-card card border-2 border-secondary-subtle rounded-4"
|
|
||||||
role="button"
|
|
||||||
tabindex="0"
|
|
||||||
@onclick="HandleClick">
|
|
||||||
|
|
||||||
<div class="card-body d-flex align-items-center justify-content-center p-4">
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg"
|
|
||||||
width="@IconSize"
|
|
||||||
height="@IconSize"
|
|
||||||
fill="currentColor"
|
|
||||||
class="bi bi-plus-circle-fill"
|
|
||||||
viewBox="0 0 16 16">
|
|
||||||
<path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0M8.5 4.5a.5.5 0 0 0-1 0v3h-3a.5.5 0 0 0 0 1h3v3a.5.5 0 0 0 1 0v-3h3a.5.5 0 0 0 0-1h-3z" />
|
|
||||||
</svg>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@code {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
using Microsoft.AspNetCore.Components.Web;
|
|
||||||
using Microsoft.AspNetCore.Components;
|
|
||||||
|
|
||||||
namespace Portfolio.WebUI.Server.Components.Component.Pokemon_Components
|
|
||||||
{
|
|
||||||
public partial class PokemonAddButton
|
|
||||||
{
|
|
||||||
[Parameter]
|
|
||||||
public EventCallback OnAdd { get; set; }
|
|
||||||
[Parameter]
|
|
||||||
public int IconSize { get; set; } = 64;
|
|
||||||
|
|
||||||
private async Task HandleClick()
|
|
||||||
{
|
|
||||||
await OnAdd.InvokeAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
.add-card {
|
|
||||||
min-width: 160px;
|
|
||||||
min-height: 120px;
|
|
||||||
max-width: 200px;
|
|
||||||
cursor: pointer;
|
|
||||||
background-color: var(--bs-info-subtle);
|
|
||||||
transition: transform .08s ease, box-shadow .08s ease, background-color .08s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.add-card:hover {
|
|
||||||
background-color: var(--bs-light);
|
|
||||||
transform: translateY(-1px);
|
|
||||||
}
|
|
||||||
|
|
||||||
.add-card:focus {
|
|
||||||
outline: none;
|
|
||||||
box-shadow: 0 0 0 .25rem rgba(13,110,253,.25);
|
|
||||||
}
|
|
||||||
|
|
||||||
.add-card[aria-disabled="true"] {
|
|
||||||
cursor: not-allowed;
|
|
||||||
}
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
<div class="pokemon-background">
|
|
||||||
@foreach (var image in _pokemonImages)
|
|
||||||
{
|
|
||||||
<img src="@image.Url"
|
|
||||||
class="pokemon-bg-img"
|
|
||||||
style="left:@image.Left%; top:@image.Top%; width:@image.Size}px; transform:rotate(@(image.Rotation)deg);" />
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
|
|
@ -1,63 +0,0 @@
|
||||||
using Microsoft.AspNetCore.Components;
|
|
||||||
using Portfolio.Domain.Features.Pokemon;
|
|
||||||
|
|
||||||
namespace Portfolio.WebUI.Server.Components.Component.Pokemon_Components
|
|
||||||
{
|
|
||||||
public partial class PokemonBackground
|
|
||||||
{
|
|
||||||
|
|
||||||
private class PokemonImage
|
|
||||||
{
|
|
||||||
public string Url { get; set; } = "";
|
|
||||||
public int Left { get; set; }
|
|
||||||
public int Top { get; set; }
|
|
||||||
public int Size { get; set; }
|
|
||||||
public int Rotation { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
[Parameter]
|
|
||||||
public List<string> PokemonImages { get; set; }
|
|
||||||
[Parameter]
|
|
||||||
public List<string> ShinyPokemonImages { get; set; }
|
|
||||||
|
|
||||||
private List<PokemonImage> _pokemonImages = new List<PokemonImage>();
|
|
||||||
private List<PokemonImage> _shinyPokemonImages = new List<PokemonImage>();
|
|
||||||
private Random random = new Random();
|
|
||||||
|
|
||||||
//protected override async Task OnInitializedAsync()
|
|
||||||
//{
|
|
||||||
// await LoadPokemonBackgrounds();
|
|
||||||
//}
|
|
||||||
|
|
||||||
//private async Task LoadPokemonBackgrounds()
|
|
||||||
//{
|
|
||||||
|
|
||||||
// foreach (var pokemonimgurl in PokemonImages)
|
|
||||||
// {
|
|
||||||
// Console.WriteLine(pokemonimgurl);
|
|
||||||
// _pokemonImages.Add(new PokemonImage
|
|
||||||
// {
|
|
||||||
// Url = pokemonimgurl, // URL retrieved from the database
|
|
||||||
// Left = random.Next(0, 100),
|
|
||||||
// Top = random.Next(0, 100),
|
|
||||||
// Size = random.Next(50, 130),
|
|
||||||
// Rotation = random.Next(0, 360)
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// foreach (var pokemonimgurl in ShinyPokemonImages)
|
|
||||||
// {
|
|
||||||
// _shinyPokemonImages.Add(new PokemonImage
|
|
||||||
// {
|
|
||||||
// Url = pokemonimgurl, // URL retrieved from the database
|
|
||||||
// Left = random.Next(0, 100),
|
|
||||||
// Top = random.Next(0, 100),
|
|
||||||
// Size = random.Next(50, 130),
|
|
||||||
// Rotation = random.Next(0, 360)
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
.pokemon-background {
|
|
||||||
position: relative;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
overflow: hidden;
|
|
||||||
background-color: #f5f5f5; /* Optional, adjust to match your design */
|
|
||||||
pointer-events: none; /* So clicks pass through the background */
|
|
||||||
z-index: 0; /* Sits behind main content */
|
|
||||||
}
|
|
||||||
|
|
||||||
.pokemon-bg-img {
|
|
||||||
position: absolute;
|
|
||||||
object-fit: contain;
|
|
||||||
filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.3)); /* Sticker-like shadow */
|
|
||||||
pointer-events: none; /* Just visual */
|
|
||||||
}
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
<div class="m-1 badge @_badgeitem.ToLower() border-0"><p class="statText">@_badgeitem</p></div>
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
using Microsoft.AspNetCore.Components;
|
|
||||||
using Portfolio.Domain.Features.Pokemon;
|
|
||||||
|
|
||||||
namespace Portfolio.WebUI.Server.Components.Component.Pokemon_Components
|
|
||||||
{
|
|
||||||
public partial class PokemonBadge
|
|
||||||
{
|
|
||||||
[Parameter]
|
|
||||||
public string BadgeItem { get; set; }
|
|
||||||
|
|
||||||
private string _badgeitem { get; set; }
|
|
||||||
|
|
||||||
protected override void OnParametersSet()
|
|
||||||
{
|
|
||||||
if (BadgeItem != null)
|
|
||||||
{
|
|
||||||
_badgeitem = BadgeItem;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,62 +0,0 @@
|
||||||
$width: 200px;
|
|
||||||
$height: 80px;
|
|
||||||
|
|
||||||
*, *::before, *::after {
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
.badge {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
width: 90px;
|
|
||||||
height: 30px;
|
|
||||||
padding: 0.25rem;
|
|
||||||
border-radius: 30px;
|
|
||||||
color: white;
|
|
||||||
font-size: clamp(0.7rem, 1vw, 0.9rem);
|
|
||||||
text-align: center;
|
|
||||||
font-weight: 400;
|
|
||||||
text-shadow: 0 2px 2px rgba(0,0,0,0.25);
|
|
||||||
box-shadow: 0 1px 2px 0 rgba(0,0,0,0.35);
|
|
||||||
transition: all 0.2s ease;
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.statText {
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
width: 100%;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Sleep Type Badge Styling */
|
|
||||||
.dozing {
|
|
||||||
background-color: #fcdc5e;
|
|
||||||
}
|
|
||||||
|
|
||||||
.snoozing {
|
|
||||||
background-color: #4ce8ed;
|
|
||||||
}
|
|
||||||
|
|
||||||
.slumbering {
|
|
||||||
background-color: #4588fb;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Speciality Badge Styling */
|
|
||||||
.berries {
|
|
||||||
background-color: #24d86b;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ingredients {
|
|
||||||
background-color: #fdbe4d;
|
|
||||||
}
|
|
||||||
|
|
||||||
.skills {
|
|
||||||
background-color: #47a0fc;
|
|
||||||
}
|
|
||||||
|
|
||||||
.all {
|
|
||||||
background-color: #fc7992;
|
|
||||||
}
|
|
||||||
|
|
@ -1,56 +0,0 @@
|
||||||
@attribute [StreamRendering]
|
|
||||||
@rendermode InteractiveServer
|
|
||||||
|
|
||||||
<div class="card-wrapper d-flex flex-column align-items-center">
|
|
||||||
<div class="pokemon-card card-holo animated @GetTypeCssClass(_pokemon.PokemonType)">
|
|
||||||
<!-- Pokemon Name, Number, and Type -->
|
|
||||||
<div class="z-3">
|
|
||||||
@if (_pokemon.IsVariation)
|
|
||||||
{
|
|
||||||
<div class="pokemon-name"><p class="fw-bold card-title">@_pokemon.VariationName @_pokemon.PokemonName</p></div>
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
<div class="pokemon-name"><p class="fw-bold card-title">@_pokemon.PokemonName</p></div>
|
|
||||||
}
|
|
||||||
<div class="pokemon-number">
|
|
||||||
<p class="fw-light card-text">Pokédex #<strong>@_pokemon.PokemonId</strong></p>
|
|
||||||
</div>
|
|
||||||
<div >
|
|
||||||
<img class="pokemon-type" src="@GetTypeImageUrl(_pokemon.PokemonType)" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Pokemon Image -->
|
|
||||||
<div class="card-image-slot z-1">
|
|
||||||
<PokemonImage baseUrl="@_pokemon.PokemonImageUrl" shinyUrl="@_pokemon.PokemonShinyImageUrl" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Pokemon Flavortext -->
|
|
||||||
<div class="z-3 pokemon-flavor-text @(GetTypeCssClass(_pokemon.PokemonType))">
|
|
||||||
@if (string.IsNullOrEmpty(_pokemon.FlavorText))
|
|
||||||
{
|
|
||||||
<p class="fw-light">[ Pokemon Flavor Text Placeholder ]</p>
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
<p class="fw-light">@_pokemon.FlavorText</p>
|
|
||||||
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Pokemon Sleep Type and Specialty Badges -->
|
|
||||||
<div class="position-absolute bottom-0 end-0 z-2">
|
|
||||||
<div class="d-flex justify-content-between">
|
|
||||||
<PokemonBadge BadgeItem="@_pokemon.SleepType" />
|
|
||||||
<PokemonBadge BadgeItem="@_pokemon.Speciality" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mt-5">
|
|
||||||
<PokemonEditButton PokemonId="@_pokemon.Id" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
@ -1,47 +0,0 @@
|
||||||
using Microsoft.AspNetCore.Components;
|
|
||||||
using Portfolio.Domain.Features.Pokemon;
|
|
||||||
|
|
||||||
namespace Portfolio.WebUI.Server.Components.Component.Pokemon_Components
|
|
||||||
{
|
|
||||||
public partial class PokemonCard
|
|
||||||
{
|
|
||||||
[Parameter]
|
|
||||||
public Pokemon Pokemon { get; set; }
|
|
||||||
|
|
||||||
private Pokemon _pokemon { get; set; }
|
|
||||||
|
|
||||||
private bool isShiny = false;
|
|
||||||
|
|
||||||
protected override void OnParametersSet()
|
|
||||||
{
|
|
||||||
if (Pokemon != null)
|
|
||||||
{
|
|
||||||
_pokemon = Pokemon;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ToggleImage()
|
|
||||||
{
|
|
||||||
isShiny = !isShiny;
|
|
||||||
StateHasChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
private string GetTypeImageUrl(string pokemonType)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(pokemonType))
|
|
||||||
{
|
|
||||||
return "https://www.serebii.net/pokemonsleep/pokemon/type/normal.png"; // Fallback image
|
|
||||||
}
|
|
||||||
|
|
||||||
return $"https://www.serebii.net/pokemonsleep/pokemon/type/{pokemonType.ToLower()}.png";
|
|
||||||
}
|
|
||||||
|
|
||||||
private string GetTypeCssClass(string type)
|
|
||||||
{
|
|
||||||
return "pokemon-type-" + type.ToLower();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,312 +0,0 @@
|
||||||
.card-wrapper {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pokemon-card {
|
|
||||||
position: relative;
|
|
||||||
width: 100%;
|
|
||||||
max-width: 350px; /* Prevent it from getting too huge */
|
|
||||||
aspect-ratio: 3 / 4; /* Maintains card shape dynamically */
|
|
||||||
overflow: hidden;
|
|
||||||
background-color: var(--bg-color);
|
|
||||||
border-width: .5rem;
|
|
||||||
border-style: solid;
|
|
||||||
border-radius: 5% / 3.5%;
|
|
||||||
border-color: var(--border-color);
|
|
||||||
box-shadow: 0 0 10px var(--border-color);
|
|
||||||
}
|
|
||||||
|
|
||||||
.pokemon-card:hover {
|
|
||||||
z-index: 10;
|
|
||||||
box-shadow: 0 0 10px var(--border-color), 0 0 20px var(--border-color), 0 0 30px var(--border-color);
|
|
||||||
transition: box-shadow 0.3s ease, transform 0.2s ease;
|
|
||||||
animation: glowPulse 1.5s ease-in-out infinite;
|
|
||||||
transform: translateY(-13px);
|
|
||||||
}
|
|
||||||
|
|
||||||
.pokemon-name {
|
|
||||||
position: absolute;
|
|
||||||
top: 5%;
|
|
||||||
left: 3%;
|
|
||||||
transform: translateY(-50%) !important;
|
|
||||||
font-size: clamp(1.2rem, 2vw, 2rem);
|
|
||||||
}
|
|
||||||
|
|
||||||
.pokemon-number {
|
|
||||||
position: absolute;
|
|
||||||
top: 10%;
|
|
||||||
left: 6%;
|
|
||||||
|
|
||||||
transform: translateY(-50%) !important;
|
|
||||||
font-size: clamp(0.7rem, 1.2vw, 0.75rem);
|
|
||||||
}
|
|
||||||
|
|
||||||
.pokemon-type {
|
|
||||||
position: absolute;
|
|
||||||
top: 2%;
|
|
||||||
right: 2%;
|
|
||||||
width: clamp(1.5rem, 2.5vw, 2.5rem);
|
|
||||||
height: clamp(1.5rem, 2.5vw, 2.5rem);
|
|
||||||
box-shadow: 0 1px 2px 1px rgba(0,0,0,0.35);
|
|
||||||
border-radius: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pokemon-flavor-text {
|
|
||||||
position: absolute;
|
|
||||||
top: 60% !important;
|
|
||||||
left: 50% !important;
|
|
||||||
width: 90%;
|
|
||||||
height: 20%;
|
|
||||||
padding: 0.25rem;
|
|
||||||
padding-left: 0.5rem;
|
|
||||||
padding-right: 0.5rem;
|
|
||||||
margin-top: 3rem !important;
|
|
||||||
transform: translateX(-50%) !important;
|
|
||||||
display: flex; /* Centers text inside */
|
|
||||||
align-items: start;
|
|
||||||
justify-content: center; /* Horizontally centers text */
|
|
||||||
overflow: hidden; /* Ensures no scrollbar */
|
|
||||||
|
|
||||||
border-width: 2px;
|
|
||||||
border-radius: 5% / 13%;
|
|
||||||
border-style: solid;
|
|
||||||
border-color: var(--border-color);
|
|
||||||
background-color: var(--flavor-bg-color);
|
|
||||||
}
|
|
||||||
|
|
||||||
.pokemon-flavor-text p {
|
|
||||||
margin: 0;
|
|
||||||
width: 100%;
|
|
||||||
text-align: start;
|
|
||||||
font-size: min(12.5px, 1.5vw); /* Scales font but won't exceed 12.5px */
|
|
||||||
line-height: 1.2; /* Adjust spacing for readability */
|
|
||||||
white-space: normal; /* Ensures wrapping */
|
|
||||||
word-wrap: break-word;
|
|
||||||
hyphens: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Position the image area within the card */
|
|
||||||
.card-image-slot {
|
|
||||||
position: absolute;
|
|
||||||
top: 50%;
|
|
||||||
left: 50%;
|
|
||||||
transform: translate(-50%, -20%);
|
|
||||||
width: 100%;
|
|
||||||
aspect-ratio: 1 / 1;
|
|
||||||
max-width: 300px;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Type Card Styling */
|
|
||||||
.pokemon-type-grass {
|
|
||||||
--border-color: #45ca24;
|
|
||||||
--bg-color: #e5f8dc;
|
|
||||||
--flavor-bg-color: #f2fbe9;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pokemon-type-fire {
|
|
||||||
--border-color: #ff662c;
|
|
||||||
--bg-color: #ffe3d5;
|
|
||||||
--flavor-bg-color: #fff0e9;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pokemon-type-water {
|
|
||||||
--border-color: #2b99fe;
|
|
||||||
--bg-color: #d6ecff;
|
|
||||||
--flavor-bg-color: #eaf5ff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pokemon-type-normal {
|
|
||||||
--border-color: #ababab;
|
|
||||||
--bg-color: #ededed;
|
|
||||||
--flavor-bg-color: #f7f7f7;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pokemon-type-flying {
|
|
||||||
--border-color: #9ed3ff;
|
|
||||||
--bg-color: #e7f5ff;
|
|
||||||
--flavor-bg-color: #f3fbff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pokemon-type-bug {
|
|
||||||
--border-color: #a7b023;
|
|
||||||
--bg-color: #f2f6cd;
|
|
||||||
--flavor-bg-color: #f9fbe4;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pokemon-type-poison {
|
|
||||||
--border-color: #9f4ed7;
|
|
||||||
--bg-color: #edd6f8;
|
|
||||||
--flavor-bg-color: #f7ebfc;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pokemon-type-electric {
|
|
||||||
--border-color: #ffdf00;
|
|
||||||
--bg-color: #fff8c6;
|
|
||||||
--flavor-bg-color: #fffbdf;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pokemon-type-ground {
|
|
||||||
--border-color: #af7d38;
|
|
||||||
--bg-color: #f0ddc2;
|
|
||||||
--flavor-bg-color: #f8eee2;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pokemon-type-rock {
|
|
||||||
--border-color: #bebd8d;
|
|
||||||
--bg-color: #f4f3dc;
|
|
||||||
--flavor-bg-color: #faf9ee;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pokemon-type-ice {
|
|
||||||
--border-color: #45e0ff;
|
|
||||||
--bg-color: #d1f7ff;
|
|
||||||
--flavor-bg-color: #e9fbff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pokemon-type-steel {
|
|
||||||
--border-color: #6db7de;
|
|
||||||
--bg-color: #daedf7;
|
|
||||||
--flavor-bg-color: #eef6fb;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pokemon-type-fighting {
|
|
||||||
--border-color: #ffa803;
|
|
||||||
--bg-color: #ffe9c6;
|
|
||||||
--flavor-bg-color: #fff3df;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pokemon-type-psychic {
|
|
||||||
--border-color: #ff6887;
|
|
||||||
--bg-color: #ffd6df;
|
|
||||||
--flavor-bg-color: #ffe8ef;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pokemon-type-dark {
|
|
||||||
--border-color: #544b4c;
|
|
||||||
--bg-color: #dedcdc;
|
|
||||||
--flavor-bg-color: #f1f0f0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pokemon-type-fairy {
|
|
||||||
--border-color: #ffb5ff;
|
|
||||||
--bg-color: #ffe6ff;
|
|
||||||
--flavor-bg-color: #fff2ff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pokemon-type-ghost {
|
|
||||||
--border-color: #714775;
|
|
||||||
--bg-color: #e2d2e4;
|
|
||||||
--flavor-bg-color: #f0e8f1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pokemon-type-dragon {
|
|
||||||
--border-color: #5669e2;
|
|
||||||
--bg-color: #d6dbfa;
|
|
||||||
--flavor-bg-color: #eaedfc;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card-holo {
|
|
||||||
position: relative;
|
|
||||||
background-image:
|
|
||||||
url("https://assets.codepen.io/13471/sparkles.gif"),
|
|
||||||
url("https://assets.codepen.io/13471/holo.png"),
|
|
||||||
linear-gradient(125deg, #ff008450 15%, #fca40040 30%, #ffff0030 40%, #00ff8a20 60%, #00cfff40 70%, #cc4cfa50 85% );
|
|
||||||
background-blend-mode: screen;
|
|
||||||
background-size: cover;
|
|
||||||
background-position: center;
|
|
||||||
background-repeat: no-repeat;
|
|
||||||
overflow: hidden;
|
|
||||||
border-radius: 1rem;
|
|
||||||
transition: transform 0.4s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card-holo:hover::before {
|
|
||||||
animation: holoGradient 12s ease 0s 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card-holo:hover::after {
|
|
||||||
animation: holoSparkle 12s ease 0s 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes holoSparkle {
|
|
||||||
0%, 100% {
|
|
||||||
opacity: .75;
|
|
||||||
background-position: 50% 50%;
|
|
||||||
filter: brightness(1.2) contrast(1.25);
|
|
||||||
}
|
|
||||||
|
|
||||||
5%, 8% {
|
|
||||||
opacity: 1;
|
|
||||||
background-position: 40% 40%;
|
|
||||||
filter: brightness(.8) contrast(1.2);
|
|
||||||
}
|
|
||||||
|
|
||||||
13%, 16% {
|
|
||||||
opacity: .5;
|
|
||||||
background-position: 50% 50%;
|
|
||||||
filter: brightness(1.2) contrast(.8);
|
|
||||||
}
|
|
||||||
|
|
||||||
35%, 38% {
|
|
||||||
opacity: 1;
|
|
||||||
background-position: 60% 60%;
|
|
||||||
filter: brightness(1) contrast(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
55% {
|
|
||||||
opacity: .33;
|
|
||||||
background-position: 45% 45%;
|
|
||||||
filter: brightness(1.2) contrast(1.25);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes holoGradient {
|
|
||||||
0%, 100% {
|
|
||||||
opacity: 0.5;
|
|
||||||
background-position: 50% 50%;
|
|
||||||
filter: brightness(.5) contrast(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
5%, 9% {
|
|
||||||
background-position: 100% 100%;
|
|
||||||
opacity: 1;
|
|
||||||
filter: brightness(.75) contrast(1.25);
|
|
||||||
}
|
|
||||||
|
|
||||||
13%, 17% {
|
|
||||||
background-position: 0% 0%;
|
|
||||||
opacity: .88;
|
|
||||||
}
|
|
||||||
|
|
||||||
35%, 39% {
|
|
||||||
background-position: 100% 100%;
|
|
||||||
opacity: 1;
|
|
||||||
filter: brightness(.5) contrast(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
55% {
|
|
||||||
background-position: 0% 0%;
|
|
||||||
opacity: 1;
|
|
||||||
filter: brightness(.75) contrast(1.25);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@keyframes glowPulse {
|
|
||||||
0% {
|
|
||||||
box-shadow: 0 0 15px var(--border-color);
|
|
||||||
}
|
|
||||||
|
|
||||||
50% {
|
|
||||||
box-shadow: 0 0 25px var(--border-color);
|
|
||||||
}
|
|
||||||
|
|
||||||
100% {
|
|
||||||
box-shadow: 0 0 15px var(--border-color);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
@inject IJSRuntime JS
|
|
||||||
|
|
||||||
<div class="">
|
|
||||||
<button class="btn btn-sm btn-primary p-1 rounded rounded-5 align-self-start text-white " @onclick="DownloadPokemonJson">
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="25" height="25" fill="currentColor" class="bi bi-arrow-down-circle" viewBox="0 0 16 16">
|
|
||||||
<path fill-rule="evenodd" d="M1 8a7 7 0 1 0 14 0A7 7 0 0 0 1 8m15 0A8 8 0 1 1 0 8a8 8 0 0 1 16 0M8.5 4.5a.5.5 0 0 0-1 0v5.793L5.354 8.146a.5.5 0 1 0-.708.708l3 3a.5.5 0 0 0 .708 0l3-3a.5.5 0 0 0-.708-.708L8.5 10.293z" />
|
|
||||||
</svg>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
||||||
using Microsoft.AspNetCore.Components;
|
|
||||||
using Microsoft.JSInterop;
|
|
||||||
using Portfolio.Domain.Features.Pokemon;
|
|
||||||
using System.Text.Json;
|
|
||||||
|
|
||||||
namespace Portfolio.WebUI.Server.Components.Component.Pokemon_Components
|
|
||||||
{
|
|
||||||
partial class PokemonDownloadButton
|
|
||||||
{
|
|
||||||
[Parameter]
|
|
||||||
public List<Pokemon> _Pokemon { get; set; }
|
|
||||||
|
|
||||||
private List<Pokemon> pokemons = new List<Pokemon>();
|
|
||||||
|
|
||||||
|
|
||||||
protected override void OnParametersSet()
|
|
||||||
{
|
|
||||||
if (_Pokemon != null)
|
|
||||||
{
|
|
||||||
pokemons = _Pokemon.ToList();
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task DownloadPokemonJson()
|
|
||||||
{
|
|
||||||
var json = JsonSerializer.Serialize(pokemons, new JsonSerializerOptions { WriteIndented = true });
|
|
||||||
await JS.InvokeVoidAsync("downloadFileFromText", "pokemon.json", "application/json", json);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
@inject NavigationManager Navigation
|
|
||||||
<button class="btn btn-warning rounded rounded-5 text-white " @onclick="() => EditPokemon(PokemonId)">
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-pencil-fill" viewBox="0 0 16 16">
|
|
||||||
<path d="M12.854.146a.5.5 0 0 0-.707 0L10.5 1.793 14.207 5.5l1.647-1.646a.5.5 0 0 0 0-.708zm.646 6.061L9.793 2.5 3.293 9H3.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.207zm-7.468 7.468A.5.5 0 0 1 6 13.5V13h-.5a.5.5 0 0 1-.5-.5V12h-.5a.5.5 0 0 1-.5-.5V11h-.5a.5.5 0 0 1-.5-.5V10h-.5a.5.5 0 0 1-.175-.032l-.179.178a.5.5 0 0 0-.11.168l-2 5a.5.5 0 0 0 .65.65l5-2a.5.5 0 0 0 .168-.11z" />
|
|
||||||
</svg>
|
|
||||||
</button>
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
||||||
using Microsoft.AspNetCore.Components;
|
|
||||||
using Microsoft.EntityFrameworkCore.Metadata.Internal;
|
|
||||||
|
|
||||||
namespace Portfolio.WebUI.Server.Components.Component.Pokemon_Components
|
|
||||||
{
|
|
||||||
public partial class PokemonEditButton
|
|
||||||
{
|
|
||||||
[Parameter] public int PokemonId { get; set; }
|
|
||||||
|
|
||||||
private void EditPokemon(int PokemonId)
|
|
||||||
{
|
|
||||||
Navigation.NavigateTo($"/pokemon-sleep/edit-pokemon/{PokemonId}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,425 +0,0 @@
|
||||||
@inject IPokemonService PokemonService
|
|
||||||
@inject IHttpClientFactory ClientFactory
|
|
||||||
|
|
||||||
@if(Ingredients == null)
|
|
||||||
{
|
|
||||||
<Loading />
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
@if(formUse == "ADD")
|
|
||||||
{
|
|
||||||
<div class="pokemon-form-container m-auto bg-info border border-5 border-info-subtle rounded-4 p-3">
|
|
||||||
<EditForm class="col" Model="NewPokemon">
|
|
||||||
<DataAnnotationsValidator />
|
|
||||||
|
|
||||||
<div class="bg-primary-subtle rounded"><p class="fs-3 fw-light text-center card-title">New Pokemon</p></div>
|
|
||||||
|
|
||||||
<!-- Pokemon Number and Name -->
|
|
||||||
<div class="row mt-1">
|
|
||||||
<div class="col input-group mb-2">
|
|
||||||
<span class="input-group-text text-sm-center rounded-start">#</span>
|
|
||||||
<InputNumber min="1"
|
|
||||||
placeholder="Pokedex #"
|
|
||||||
id="PokemonId"
|
|
||||||
@bind-Value="NewPokemon.PokemonId"
|
|
||||||
@onchange="@SendPokemon"
|
|
||||||
class="form-control "
|
|
||||||
type="number" />
|
|
||||||
<InputText placeholder="Pokemon Name"
|
|
||||||
id="PokemonName"
|
|
||||||
@bind-Value="NewPokemon.PokemonName"
|
|
||||||
@onchange="@SendPokemon"
|
|
||||||
class="form-control w-50 rounded-end" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Variation Check -->
|
|
||||||
<div class="d-flex flex-row justify-content-start input-group ">
|
|
||||||
<InputCheckbox id="IsVariation"
|
|
||||||
@bind-Value="NewPokemon.IsVariation"
|
|
||||||
@onclick="@Toggle"
|
|
||||||
@onchange="@SendPokemon"
|
|
||||||
class="form-check-input p-3 rounded" />
|
|
||||||
<span class="input-group-text ms-1 @GetRoundingClass()">Variation?</span>
|
|
||||||
<InputText placeholder="How So?"
|
|
||||||
id="VariationName"
|
|
||||||
@bind-Value="NewPokemon.VariationName"
|
|
||||||
@onchange="@SendPokemon"
|
|
||||||
class="form-control rounded-end"
|
|
||||||
hidden="@HideLabel" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- <br> -->
|
|
||||||
<div class="border-bottom border-3 border-info-subtle rounded m-1 my-3"></div>
|
|
||||||
|
|
||||||
<!-- Pokemon Type -->
|
|
||||||
<div class="row mb-2">
|
|
||||||
<div class="input-group m-auto">
|
|
||||||
<span for="PokemonType" class="input-group-text rounded-start">Pokemon Type</span>
|
|
||||||
<InputSelect id="PokemonType" @bind-Value="NewPokemon.PokemonType" @onchange="@SendPokemon" class="form-select rounded-end">
|
|
||||||
<option disabled value="" selected>Select...</option>
|
|
||||||
@foreach (var pt in PkmnTypes)
|
|
||||||
{
|
|
||||||
<option value="@pt.Type">@pt.Type</option>
|
|
||||||
}
|
|
||||||
</InputSelect>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Pokemon Sleep Type, Specialty -->
|
|
||||||
<div class="row mb-3 mx-0">
|
|
||||||
<!-- Sleep Type -->
|
|
||||||
<div class="col ps-0 pe-1">
|
|
||||||
<div class="row input-group m-auto">
|
|
||||||
<span for="SleepType" class="input-group-text rounded-top">Sleep Type</span>
|
|
||||||
</div>
|
|
||||||
<div class="row input-group m-auto">
|
|
||||||
<InputSelect id="SleepType" @bind-Value="NewPokemon.SleepType" @onchange="@SendPokemon" class="form-select rounded-bottom">
|
|
||||||
<option disabled value="" selected>Select...</option>
|
|
||||||
@foreach (var st in SleepTypes)
|
|
||||||
{
|
|
||||||
<option value="@st">@st</option>
|
|
||||||
}
|
|
||||||
</InputSelect>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- Speciality -->
|
|
||||||
<div class="col ps-1 pe-0">
|
|
||||||
<div class="row input-group m-auto">
|
|
||||||
<span for="Speciality" class="input-group-text rounded-top">Specialty</span>
|
|
||||||
</div>
|
|
||||||
<div class="row input-group m-auto">
|
|
||||||
<InputSelect id="Speciality" @bind-Value="NewPokemon.Speciality" @onchange="@SendPokemon" class="form-select rounded-bottom">
|
|
||||||
<option disabled value="" selected>Select...</option>
|
|
||||||
@foreach (var sp in Specialities)
|
|
||||||
{
|
|
||||||
<option value="@sp">@sp</option>
|
|
||||||
}
|
|
||||||
</InputSelect>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Pokemon Ingredients -->
|
|
||||||
<div class="row mb-3 mx-0">
|
|
||||||
<!-- Ingredient 1 -->
|
|
||||||
<div class="col ps-0 pe-1">
|
|
||||||
<div class="row input-group m-auto">
|
|
||||||
<span for="Ingredient1" class="input-group-text rounded-top">Ingredient 1</span>
|
|
||||||
</div>
|
|
||||||
<div class="row input-group m-auto">
|
|
||||||
<InputSelect id="Ingredient1" @bind-Value="NewPokemon.Ingredient1" @onchange="@SendPokemon" class="form-select rounded-bottom">
|
|
||||||
<option disabled value="" selected>Select...</option>
|
|
||||||
@foreach (var ingredient in Ingredients)
|
|
||||||
{
|
|
||||||
<option value="@ingredient.Name">@ingredient.Name</option>
|
|
||||||
}
|
|
||||||
</InputSelect>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- Ingredient 2 -->
|
|
||||||
<div class="col ps-0 pe-1">
|
|
||||||
<div class="row input-group m-auto">
|
|
||||||
<span for="Ingredient2" class="input-group-text rounded-top">Ingredient 2</span>
|
|
||||||
</div>
|
|
||||||
<div class="row input-group m-auto">
|
|
||||||
<InputSelect id="Ingredient2" @bind-Value="NewPokemon.Ingredient2" @onchange="@SendPokemon" class="form-select rounded-bottom">
|
|
||||||
<option disabled value="" selected>Select...</option>
|
|
||||||
@foreach (var ingredient in Ingredients)
|
|
||||||
{
|
|
||||||
<option value="@ingredient.Name">@ingredient.Name</option>
|
|
||||||
}
|
|
||||||
</InputSelect>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- Ingredient 3 -->
|
|
||||||
<div class="col ps-0 pe-1">
|
|
||||||
<div class="row input-group m-auto">
|
|
||||||
<span for="Ingredient3" class="input-group-text rounded-top">Ingredient 3</span>
|
|
||||||
</div>
|
|
||||||
<div class="row input-group m-auto">
|
|
||||||
<InputSelect id="Ingredient3" @bind-Value="NewPokemon.Ingredient3" @onchange="@SendPokemon" class="form-select rounded-bottom">
|
|
||||||
<option disabled value="" selected>Select...</option>
|
|
||||||
@foreach (var ingredient in Ingredients)
|
|
||||||
{
|
|
||||||
<option value="@ingredient.Name">@ingredient.Name</option>
|
|
||||||
}
|
|
||||||
</InputSelect>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- <br> -->
|
|
||||||
<div class="border-bottom border-3 border-info-subtle rounded m-1 my-3"></div>
|
|
||||||
|
|
||||||
<!-- Images -->
|
|
||||||
<div class="row mb-2">
|
|
||||||
<div class="input-group m-auto">
|
|
||||||
<span for="ImageUrl" class="input-group-text rounded-start">Base Image URL</span>
|
|
||||||
<InputText id="ImageUrl" @bind-Value="NewPokemon.PokemonImageUrl" @onchange="@SendPokemon" class="form-control rounded-end" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row mb-2">
|
|
||||||
<div class="input-group m-auto">
|
|
||||||
<span for="ShinyImageUrl" class="input-group-text rounded-start">Shiny Image URL</span>
|
|
||||||
<InputText id="ShinyImageUrl" @bind-Value="NewPokemon.PokemonShinyImageUrl" @onchange="@SendPokemon" class="form-control rounded-end" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Flavor -->
|
|
||||||
<div class="row mb-2">
|
|
||||||
<div class="input-group m-auto">
|
|
||||||
<span for="FlavorText" class="input-group-text rounded-start">Flavor Text</span>
|
|
||||||
<InputText id="FlavorText" @bind-Value="NewPokemon.FlavorText" @onchange="@SendPokemon" class="form-control rounded-end" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- <br> -->
|
|
||||||
<div class="border-bottom border-3 border-info-subtle rounded m-1 my-3"></div>
|
|
||||||
|
|
||||||
@if (showErrors && !IsComplete)
|
|
||||||
{
|
|
||||||
<div class="alert alert-warning mt-2">
|
|
||||||
Please complete: @string.Join(", ", MissingFields())
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
|
|
||||||
<div class="d-flex mt-3 justify-content-center gap-3">
|
|
||||||
<button type="button"
|
|
||||||
class="btn btn-success rounded rounded-5 p-1"
|
|
||||||
@onclick="@SendPokemon">
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor" class="bi bi-plus-circle" viewBox="0 0 16 16">
|
|
||||||
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14m0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16" />
|
|
||||||
<path d="M8 4a.5.5 0 0 1 .5.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3A.5.5 0 0 1 8 4" />
|
|
||||||
</svg>
|
|
||||||
|
|
||||||
</button>
|
|
||||||
@if (mostRecentForm)
|
|
||||||
{
|
|
||||||
<button type="button"
|
|
||||||
class="btn btn-danger rounded rounded-5 p-1"
|
|
||||||
@onclick="@HandleRemove">
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor" class="bi bi-x-circle" viewBox="0 0 16 16">
|
|
||||||
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14m0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16" />
|
|
||||||
<path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708" />
|
|
||||||
</svg>
|
|
||||||
</button>
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
<button type="button"
|
|
||||||
class="btn btn-danger rounded rounded-5 p-1"
|
|
||||||
|
|
||||||
disabled>
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor" class="bi bi-x-circle" viewBox="0 0 16 16">
|
|
||||||
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14m0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16" />
|
|
||||||
<path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708" />
|
|
||||||
</svg>
|
|
||||||
</button>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
</EditForm>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
}
|
|
||||||
else if (formUse == "EDIT")
|
|
||||||
{
|
|
||||||
<div class="pokemon-form-container m-auto bg-info border border-5 border-info-subtle rounded-4 p-3">
|
|
||||||
<EditForm class="col" Model="PokemonToEdit">
|
|
||||||
<DataAnnotationsValidator />
|
|
||||||
|
|
||||||
<div class="bg-primary-subtle rounded"><p class="fs-3 fw-light text-center card-title">Edit Pokemon</p></div>
|
|
||||||
|
|
||||||
<!-- Pokemon Number and Name -->
|
|
||||||
<div class="row mt-1">
|
|
||||||
<div class="col input-group mb-2">
|
|
||||||
<span class="input-group-text text-sm-center rounded-start">#</span>
|
|
||||||
<InputNumber min="1"
|
|
||||||
placeholder="Pokedex #"
|
|
||||||
id="PokemonId"
|
|
||||||
@bind-Value="PokemonToEdit.PokemonId"
|
|
||||||
@onchange="@SendPokemon"
|
|
||||||
class="form-control "
|
|
||||||
type="number" />
|
|
||||||
<InputText placeholder="Pokemon Name"
|
|
||||||
id="PokemonName"
|
|
||||||
@bind-Value="PokemonToEdit.PokemonName"
|
|
||||||
@onchange="@SendPokemon"
|
|
||||||
class="form-control w-50 rounded-end" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Variation Check -->
|
|
||||||
<div class="d-flex flex-row justify-content-start input-group ">
|
|
||||||
<InputCheckbox id="IsVariation"
|
|
||||||
@bind-Value="PokemonToEdit.IsVariation"
|
|
||||||
@onclick="@Toggle"
|
|
||||||
@onchange="@SendPokemon"
|
|
||||||
class="form-check-input p-3 rounded" />
|
|
||||||
<span class="input-group-text ms-1 @GetRoundingClass()">Variation?</span>
|
|
||||||
<InputText placeholder="How So?"
|
|
||||||
id="VariationName"
|
|
||||||
@bind-Value="PokemonToEdit.VariationName"
|
|
||||||
@onchange="@SendPokemon"
|
|
||||||
class="form-control rounded-end"
|
|
||||||
hidden="@HideLabel" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- <br> -->
|
|
||||||
<div class="border-bottom border-3 border-info-subtle rounded m-1 my-3"></div>
|
|
||||||
|
|
||||||
<!-- Pokemon Type -->
|
|
||||||
<div class="row mb-2">
|
|
||||||
<div class="input-group m-auto">
|
|
||||||
<span for="PokemonType" class="input-group-text rounded-start">Pokemon Type</span>
|
|
||||||
<InputSelect id="PokemonType" @bind-Value="PokemonToEdit.PokemonType" class="form-select rounded-end" @onchange="@SendPokemon">
|
|
||||||
<option disabled value="" selected>Select...</option>
|
|
||||||
@foreach (var pt in PokemonTypes)
|
|
||||||
{
|
|
||||||
<option value="@pt">@pt</option>
|
|
||||||
}
|
|
||||||
</InputSelect>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Pokemon Sleep Type, Specialty -->
|
|
||||||
<div class="row mb-3 mx-0">
|
|
||||||
<!-- Sleep Type -->
|
|
||||||
<div class="col ps-0 pe-1">
|
|
||||||
<div class="row input-group m-auto">
|
|
||||||
<span for="SleepType" class="input-group-text rounded-top">Sleep Type</span>
|
|
||||||
</div>
|
|
||||||
<div class="row input-group m-auto">
|
|
||||||
<InputSelect id="SleepType" @bind-Value="PokemonToEdit.SleepType" class="form-select rounded-bottom" @onchange="@SendPokemon">
|
|
||||||
<option disabled value="" selected>Select...</option>
|
|
||||||
@foreach (var st in SleepTypes)
|
|
||||||
{
|
|
||||||
<option value="@st">@st</option>
|
|
||||||
}
|
|
||||||
</InputSelect>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- Speciality -->
|
|
||||||
<div class="col ps-1 pe-0">
|
|
||||||
<div class="row input-group m-auto">
|
|
||||||
<span for="Speciality" class="input-group-text rounded-top">Specialty</span>
|
|
||||||
</div>
|
|
||||||
<div class="row input-group m-auto">
|
|
||||||
<InputSelect id="Speciality" @bind-Value="PokemonToEdit.Speciality" class="form-select rounded-bottom" @onchange="@SendPokemon">
|
|
||||||
<option disabled value="" selected>Select...</option>
|
|
||||||
@foreach (var sp in Specialities)
|
|
||||||
{
|
|
||||||
<option value="@sp">@sp</option>
|
|
||||||
}
|
|
||||||
</InputSelect>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Pokemon Ingredients -->
|
|
||||||
<div class="row mb-3 mx-0">
|
|
||||||
<!-- Ingredient 1 -->
|
|
||||||
<div class="col ps-0 pe-1">
|
|
||||||
<div class="row input-group m-auto">
|
|
||||||
<span for="Ingredient1" class="input-group-text rounded-top">Ingredient 1</span>
|
|
||||||
</div>
|
|
||||||
<div class="row input-group m-auto">
|
|
||||||
<InputSelect id="Ingredient1" @bind-Value="PokemonToEdit.Ingredient1" @onchange="@SendPokemon" class="form-select rounded-bottom">
|
|
||||||
<option disabled value="" selected>Select...</option>
|
|
||||||
@foreach (var ingredient in Ingredients)
|
|
||||||
{
|
|
||||||
<option value="@ingredient.Name">@ingredient.Name</option>
|
|
||||||
}
|
|
||||||
</InputSelect>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- Ingredient 2 -->
|
|
||||||
<div class="col ps-0 pe-1">
|
|
||||||
<div class="row input-group m-auto">
|
|
||||||
<span for="Ingredient2" class="input-group-text rounded-top">Ingredient 2</span>
|
|
||||||
</div>
|
|
||||||
<div class="row input-group m-auto">
|
|
||||||
<InputSelect id="Ingredient2" @bind-Value="PokemonToEdit.Ingredient2" @onchange="@SendPokemon" class="form-select rounded-bottom">
|
|
||||||
<option disabled value="" selected>Select...</option>
|
|
||||||
@foreach (var ingredient in Ingredients)
|
|
||||||
{
|
|
||||||
<option value="@ingredient.Name">@ingredient.Name</option>
|
|
||||||
}
|
|
||||||
</InputSelect>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- Ingredient 3 -->
|
|
||||||
<div class="col ps-0 pe-1">
|
|
||||||
<div class="row input-group m-auto">
|
|
||||||
<span for="Ingredient3" class="input-group-text rounded-top">Ingredient 3</span>
|
|
||||||
</div>
|
|
||||||
<div class="row input-group m-auto">
|
|
||||||
<InputSelect id="Ingredient3" @bind-Value="PokemonToEdit.Ingredient3" @onchange="@SendPokemon" class="form-select rounded-bottom">
|
|
||||||
<option disabled value="" selected>Select...</option>
|
|
||||||
@foreach (var ingredient in Ingredients)
|
|
||||||
{
|
|
||||||
<option value="@ingredient.Name">@ingredient.Name</option>
|
|
||||||
}
|
|
||||||
</InputSelect>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- <br> -->
|
|
||||||
<div class="border-bottom border-3 border-info-subtle rounded m-1 my-3"></div>
|
|
||||||
|
|
||||||
<!-- Images -->
|
|
||||||
<div class="row mb-2">
|
|
||||||
<div class="input-group m-auto">
|
|
||||||
<span for="ImageUrl" class="input-group-text rounded-start">Base Image URL</span>
|
|
||||||
<InputText id="ImageUrl" @bind-Value="PokemonToEdit.PokemonImageUrl" class="form-control rounded-end" @onchange="@SendPokemon" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row mb-2">
|
|
||||||
<div class="input-group m-auto">
|
|
||||||
<span for="ShinyImageUrl" class="input-group-text rounded-start">Shiny Image URL</span>
|
|
||||||
<InputText id="ShinyImageUrl" @bind-Value="PokemonToEdit.PokemonShinyImageUrl" class="form-control rounded-end" @onchange="@SendPokemon" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Flavor -->
|
|
||||||
<div class="row mb-2">
|
|
||||||
<div class="input-group m-auto">
|
|
||||||
<span for="FlavorText" class="input-group-text rounded-start">Flavor Text</span>
|
|
||||||
<InputText id="FlavorText" @bind-Value="PokemonToEdit.FlavorText" class="form-control rounded-end" @onchange="@SendPokemon" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- <br> -->
|
|
||||||
<div class="border-bottom border-3 border-info-subtle rounded m-1 my-3"></div>
|
|
||||||
|
|
||||||
@if (showErrors && !IsComplete)
|
|
||||||
{
|
|
||||||
<div class="alert alert-warning mt-2">
|
|
||||||
Please complete: @string.Join(", ", MissingFields())
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
|
|
||||||
<div class="d-flex mt-3 justify-content-center gap-3">
|
|
||||||
@if (mostRecentForm)
|
|
||||||
{
|
|
||||||
<button type="button"
|
|
||||||
class="btn btn-danger rounded rounded-5 p-1"
|
|
||||||
@onclick="@HandleRemove">
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor" class="bi bi-x-circle" viewBox="0 0 16 16">
|
|
||||||
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14m0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16" />
|
|
||||||
<path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708" />
|
|
||||||
</svg>
|
|
||||||
</button>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
</EditForm>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,190 +0,0 @@
|
||||||
using Microsoft.AspNetCore.Components;
|
|
||||||
using Microsoft.AspNetCore.Components.Web;
|
|
||||||
using Microsoft.EntityFrameworkCore.Metadata.Internal;
|
|
||||||
using Portfolio.Application.Services.PokemonService;
|
|
||||||
using Portfolio.Domain.Features.Pokemon;
|
|
||||||
using Portfolio.Domain.Features.Portfolio;
|
|
||||||
|
|
||||||
namespace Portfolio.WebUI.Server.Components.Component.Pokemon_Components
|
|
||||||
{
|
|
||||||
public partial class PokemonForm
|
|
||||||
{
|
|
||||||
// To Add or Edit Pokemon
|
|
||||||
[Parameter]
|
|
||||||
public string formUse { get; set; }
|
|
||||||
|
|
||||||
private bool formChanged { get; set; } = false;
|
|
||||||
|
|
||||||
[Parameter]
|
|
||||||
public EventCallback<Pokemon> OnPokemonReady { get; set; }
|
|
||||||
[Parameter]
|
|
||||||
public EventCallback RemoveForm { get; set; }
|
|
||||||
|
|
||||||
// When Adding
|
|
||||||
[Parameter]
|
|
||||||
public bool mostRecentForm { get; set; }
|
|
||||||
private Pokemon NewPokemon = new Pokemon
|
|
||||||
{
|
|
||||||
PokemonId = 0, // Or any default ID logic
|
|
||||||
PokemonName = string.Empty, // Required fields cannot be null
|
|
||||||
PokemonType = string.Empty, // Required fields cannot be null
|
|
||||||
SleepType = string.Empty,
|
|
||||||
Speciality = string.Empty,
|
|
||||||
IsVariation = false
|
|
||||||
};
|
|
||||||
|
|
||||||
// When Editing
|
|
||||||
[Parameter]
|
|
||||||
public Pokemon? PokemonToEdit { get; set; }
|
|
||||||
private int PokemonToEditId { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
// General Form
|
|
||||||
|
|
||||||
protected static readonly string[] PokemonTypes = new[]
|
|
||||||
{
|
|
||||||
"Grass","Fire","Water","Normal","Flying","Bug","Poison","Electric","Ground","Rock","Ice",
|
|
||||||
"Steel","Fighting","Psychic","Dark","Fairy","Ghost","Dragon"
|
|
||||||
};
|
|
||||||
protected static readonly string[] SleepTypes = new[] { "Dozing", "Snoozing", "Slumbering" };
|
|
||||||
protected static readonly string[] Specialities = new[] { "Berries", "Ingredients", "Skills", "All" };
|
|
||||||
|
|
||||||
private List<Ingredient>? Ingredients;
|
|
||||||
private List<PokemonType>? PkmnTypes;
|
|
||||||
private bool HideLabel { get; set; }
|
|
||||||
private bool showErrors { get; set; } = false;
|
|
||||||
|
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
|
||||||
{
|
|
||||||
var http = ClientFactory.CreateClient("LocalClient");
|
|
||||||
Ingredients = await http.GetFromJsonAsync<List<Ingredient>>("data/ingredients.json");
|
|
||||||
PkmnTypes = await http.GetFromJsonAsync<List<PokemonType>>("data/pkmn_type-and-berries.json");
|
|
||||||
var count = 0;
|
|
||||||
foreach (var t in PkmnTypes)
|
|
||||||
{
|
|
||||||
count++;
|
|
||||||
//if (count <= 9) { Console.WriteLine("0"+ count + ": | " + t.Type + "\t| " + t.Berry); }
|
|
||||||
//else { Console.WriteLine(count + ": | " + t.Type + "\t| " + t.Berry); }
|
|
||||||
}
|
|
||||||
if (formUse == "EDIT")
|
|
||||||
{
|
|
||||||
if (PokemonToEdit.IsVariation == true)
|
|
||||||
{
|
|
||||||
HideLabel = false;
|
|
||||||
}
|
|
||||||
PokemonToEditId = PokemonToEdit.Id;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
HideLabel = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void Toggle()
|
|
||||||
{
|
|
||||||
HideLabel = !HideLabel;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ToggleFormChange()
|
|
||||||
{
|
|
||||||
formChanged = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// CSS-function to get proper styling for form elements
|
|
||||||
private string GetRoundingClass()
|
|
||||||
{
|
|
||||||
if (!HideLabel)
|
|
||||||
{
|
|
||||||
return "rounded-start";
|
|
||||||
}
|
|
||||||
return "rounded-start rounded-end";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Minimal "complete" check (no data annotations needed)
|
|
||||||
private bool IsComplete =>
|
|
||||||
NewPokemon.PokemonId > 0 &&
|
|
||||||
!string.IsNullOrWhiteSpace(NewPokemon.PokemonName) &&
|
|
||||||
!string.IsNullOrWhiteSpace(NewPokemon.PokemonType) &&
|
|
||||||
!string.IsNullOrWhiteSpace(NewPokemon.SleepType) &&
|
|
||||||
!string.IsNullOrWhiteSpace(NewPokemon.Speciality) &&
|
|
||||||
(!NewPokemon.IsVariation || !string.IsNullOrWhiteSpace(NewPokemon.VariationName));
|
|
||||||
|
|
||||||
private IEnumerable<string> MissingFields()
|
|
||||||
{
|
|
||||||
if (NewPokemon.PokemonId <= 0) yield return "Pokédex #";
|
|
||||||
if (string.IsNullOrWhiteSpace(NewPokemon.PokemonName)) yield return "Name";
|
|
||||||
if (string.IsNullOrWhiteSpace(NewPokemon.PokemonType)) yield return "Type";
|
|
||||||
if (string.IsNullOrWhiteSpace(NewPokemon.SleepType)) yield return "Sleep Type";
|
|
||||||
if (string.IsNullOrWhiteSpace(NewPokemon.Speciality)) yield return "Specialty";
|
|
||||||
if (NewPokemon.IsVariation && string.IsNullOrWhiteSpace(NewPokemon.VariationName)) yield return "Variation Name";
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task HandleRemove()
|
|
||||||
{
|
|
||||||
await RemoveForm.InvokeAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task SendPokemon()
|
|
||||||
{
|
|
||||||
Console.WriteLine("onchange");
|
|
||||||
if(formUse == "ADD")
|
|
||||||
{
|
|
||||||
if (!IsComplete)
|
|
||||||
{
|
|
||||||
showErrors = true;
|
|
||||||
StateHasChanged();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Optionally send a copy to avoid later mutation by the child
|
|
||||||
var copy = new Pokemon
|
|
||||||
{
|
|
||||||
PokemonId = NewPokemon.PokemonId,
|
|
||||||
PokemonName = NewPokemon.PokemonName,
|
|
||||||
PokemonType = NewPokemon.PokemonType,
|
|
||||||
SleepType = NewPokemon.SleepType,
|
|
||||||
Speciality = NewPokemon.Speciality,
|
|
||||||
IsVariation = NewPokemon.IsVariation,
|
|
||||||
VariationName = NewPokemon.VariationName,
|
|
||||||
PokemonImageUrl = NewPokemon.PokemonImageUrl,
|
|
||||||
PokemonShinyImageUrl = NewPokemon.PokemonShinyImageUrl,
|
|
||||||
FlavorText = NewPokemon.FlavorText,
|
|
||||||
Ingredient1 = NewPokemon.Ingredient1,
|
|
||||||
Ingredient2 = NewPokemon.Ingredient2,
|
|
||||||
Ingredient3 = NewPokemon.Ingredient3
|
|
||||||
};
|
|
||||||
|
|
||||||
await OnPokemonReady.InvokeAsync(copy);
|
|
||||||
formChanged = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Optionally send a copy to avoid later mutation by the child
|
|
||||||
var edit = new Pokemon
|
|
||||||
{
|
|
||||||
Id = PokemonToEditId,
|
|
||||||
PokemonId = PokemonToEdit.PokemonId,
|
|
||||||
PokemonName = PokemonToEdit.PokemonName,
|
|
||||||
PokemonType = PokemonToEdit.PokemonType,
|
|
||||||
SleepType = PokemonToEdit.SleepType,
|
|
||||||
Speciality = PokemonToEdit.Speciality,
|
|
||||||
IsVariation = PokemonToEdit.IsVariation,
|
|
||||||
VariationName = PokemonToEdit.VariationName,
|
|
||||||
PokemonImageUrl = PokemonToEdit.PokemonImageUrl,
|
|
||||||
PokemonShinyImageUrl = PokemonToEdit.PokemonShinyImageUrl,
|
|
||||||
FlavorText = PokemonToEdit.FlavorText,
|
|
||||||
Ingredient1 = PokemonToEdit.Ingredient1,
|
|
||||||
Ingredient2 = PokemonToEdit.Ingredient2,
|
|
||||||
Ingredient3 = PokemonToEdit.Ingredient3
|
|
||||||
};
|
|
||||||
|
|
||||||
await OnPokemonReady.InvokeAsync(edit);
|
|
||||||
Console.WriteLine(edit);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
|
|
||||||
$display-font-sizes: (
|
|
||||||
1: 5rem,
|
|
||||||
2: 4.5rem,
|
|
||||||
3: 4rem,
|
|
||||||
4: 3.5rem,
|
|
||||||
5: 3rem,
|
|
||||||
6: 2.5rem
|
|
||||||
);
|
|
||||||
|
|
||||||
.pokemon-form-container {
|
|
||||||
position: relative;
|
|
||||||
aspect-ratio: 3 / 4; /* Maintains card shape dynamically */
|
|
||||||
background-color: var(--bg-color);
|
|
||||||
border-width: .5rem;
|
|
||||||
border-style: solid;
|
|
||||||
border-radius: 5% / 3.5%;
|
|
||||||
border-color: var(--border-color);
|
|
||||||
box-shadow: 0 0 10px var(--border-color);
|
|
||||||
}
|
|
||||||
|
|
||||||
.checkbox-styling {
|
|
||||||
width: 100px;
|
|
||||||
height: 100px;
|
|
||||||
}
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
<div class="wrapper">
|
|
||||||
@if (shinyUrl == null)
|
|
||||||
{
|
|
||||||
<div class="flip-container">
|
|
||||||
<div class="flipper">
|
|
||||||
<img class="front" src="@baseUrl" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
<div class="flip-container" @onclick="() => ToggleImage()">
|
|
||||||
<div class="flipper @(isShiny ? "flipped" : "")">
|
|
||||||
<img class="front" src="@baseUrl" />
|
|
||||||
<img class="back" src="@shinyUrl" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
using Microsoft.AspNetCore.Components;
|
|
||||||
|
|
||||||
namespace Portfolio.WebUI.Server.Components.Component.Pokemon_Components
|
|
||||||
{
|
|
||||||
public partial class PokemonImage
|
|
||||||
{
|
|
||||||
[Parameter]
|
|
||||||
public string baseUrl { get; set; }
|
|
||||||
[Parameter]
|
|
||||||
public string shinyUrl { get; set; }
|
|
||||||
|
|
||||||
private bool isShiny = false;
|
|
||||||
|
|
||||||
private void ToggleImage()
|
|
||||||
{
|
|
||||||
isShiny = !isShiny;
|
|
||||||
StateHasChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,50 +0,0 @@
|
||||||
.wrapper {
|
|
||||||
display: inline-block;
|
|
||||||
width: 90%;
|
|
||||||
height: 90%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.flip-container {
|
|
||||||
position: absolute !important;
|
|
||||||
top: 40% !important;
|
|
||||||
left: 50% !important;
|
|
||||||
transform: translate(-50%, -50%) !important;
|
|
||||||
perspective: 1000px;
|
|
||||||
display: inline-block;
|
|
||||||
width: 80%;
|
|
||||||
aspect-ratio: 1 / 1;
|
|
||||||
max-width: 280px;
|
|
||||||
margin: 0 auto;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.flipper {
|
|
||||||
transition: transform 0.6s;
|
|
||||||
transform-style: preserve-3d;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
.flipped {
|
|
||||||
transform: rotateY(180deg);
|
|
||||||
}
|
|
||||||
|
|
||||||
.wrapper {
|
|
||||||
position: relative;
|
|
||||||
max-height: 100px;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.front, .back {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
position: absolute;
|
|
||||||
inset: 0; /* shorthand for top/right/bottom/left: 0 */
|
|
||||||
backface-visibility: hidden;
|
|
||||||
object-fit: contain; /* keep aspect ratio inside the box */
|
|
||||||
}
|
|
||||||
|
|
||||||
.back {
|
|
||||||
transform: rotateY(180deg);
|
|
||||||
}
|
|
||||||
|
|
@ -1,43 +0,0 @@
|
||||||
<!-- Pokemon Navigation Buttons -->
|
|
||||||
<div class="mx-auto w-75 top-row row" >
|
|
||||||
<div class="row btn-group d-flex justify-content-end" >
|
|
||||||
<!-- Home -->
|
|
||||||
<button class="btn btn-primary mx-1 align-content-center" style="border-radius: 50px 15px; max-width: 60px;">
|
|
||||||
<NavLink href="/pokemon-sleep">
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-house-fill mb-1 text-white" viewBox="0 0 16 16">
|
|
||||||
<path d="M8.707 1.5a1 1 0 0 0-1.414 0L.646 8.146a.5.5 0 0 0 .708.708L8 2.207l6.646 6.647a.5.5 0 0 0 .708-.708L13 5.793V2.5a.5.5 0 0 0-.5-.5h-1a.5.5 0 0 0-.5.5v1.293z" />
|
|
||||||
<path d="m8 3.293 6 6V13.5a1.5 1.5 0 0 1-1.5 1.5h-9A1.5 1.5 0 0 1 2 13.5V9.293z" />
|
|
||||||
</svg>
|
|
||||||
</NavLink>
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<!-- Pokemon Table-->
|
|
||||||
<button class="btn btn-info mx-1" style="border-radius: 50px 15px; max-width: 60px;">
|
|
||||||
<NavLink href="/pokemon-sleep/pokemon">
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-table mb-1 text-white" viewBox="0 0 16 16">
|
|
||||||
<path d="M0 2a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2zm15 2h-4v3h4zm0 4h-4v3h4zm0 4h-4v3h3a1 1 0 0 0 1-1zm-5 3v-3H6v3zm-5 0v-3H1v2a1 1 0 0 0 1 1zm-4-4h4V8H1zm0-4h4V4H1zm5-3v3h4V4zm4 4H6v3h4z" />
|
|
||||||
</svg>
|
|
||||||
</NavLink>
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<!-- Rate Pokemon -->
|
|
||||||
<button class="btn btn-success mx-1" style="border-radius: 50px 15px; max-width: 60px;">
|
|
||||||
<NavLink href="/pokemon-sleep/rate-pokemon">
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-award-fill mb-1 text-white" viewBox="0 0 16 16">
|
|
||||||
<path d="m8 0 1.669.864 1.858.282.842 1.68 1.337 1.32L13.4 6l.306 1.854-1.337 1.32-.842 1.68-1.858.282L8 12l-1.669-.864-1.858-.282-.842-1.68-1.337-1.32L2.6 6l-.306-1.854 1.337-1.32.842-1.68L6.331.864z" />
|
|
||||||
<path d="M4 11.794V16l4-1 4 1v-4.206l-2.018.306L8 13.126 6.018 12.1z" />
|
|
||||||
</svg>
|
|
||||||
</NavLink>
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<!-- Add Pokemon (Wrap in Auth) -->
|
|
||||||
<button class="btn btn-warning mx-1 " style="border-radius: 50px 15px; max-width: 60px;">
|
|
||||||
<NavLink href="/pokemon-sleep/add-new-pokemon">
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-plus-circle-fill text-white" viewBox="0 0 16 16">
|
|
||||||
<path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0M8.5 4.5a.5.5 0 0 0-1 0v3h-3a.5.5 0 0 0 0 1h3v3a.5.5 0 0 0 1 0v-3h3a.5.5 0 0 0 0-1h-3z" />
|
|
||||||
</svg>
|
|
||||||
</NavLink>
|
|
||||||
</button>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
namespace Portfolio.WebUI.Server.Components.Component.Pokemon_Components
|
|
||||||
{
|
|
||||||
public partial class PokemonNavMenu
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
body {
|
|
||||||
}
|
|
||||||
|
|
@ -1,135 +0,0 @@
|
||||||
<div class="pokemon-rating-panel">
|
|
||||||
|
|
||||||
<!-- Dropdown Selects -->
|
|
||||||
<div class="ratings bg-light-subtle col">
|
|
||||||
<h3 class="mb-3 row">Select Nature & Subskills</h3>
|
|
||||||
|
|
||||||
<!-- Nature -->
|
|
||||||
<div class="d-flex justify-content-between align-items-center row">
|
|
||||||
<div class="col">
|
|
||||||
<label>Select Nature</label>
|
|
||||||
<select class="form-control" @bind="SelectedNatureId">
|
|
||||||
<option value="" disabled selected >Choose Nature...</option>
|
|
||||||
@foreach (var nature in NatureList)
|
|
||||||
{
|
|
||||||
<option value="@nature.Id">@nature.Nature</option>
|
|
||||||
}
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="text-center col">
|
|
||||||
<h4 class="mt-4">
|
|
||||||
<span class="text-muted">@lastnaturescore</span>
|
|
||||||
</h4>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Subskill 1 -->
|
|
||||||
<div class="d-flex justify-content-between align-items-center mt-3 row">
|
|
||||||
<div class="col">
|
|
||||||
<label for="subskillSelect1">Select Level 10 Subskill</label>
|
|
||||||
<select id="subskillSelect1" class="form-control" @bind="Subskill1">
|
|
||||||
<option value="" disabled selected>Choose Subskill...</option>
|
|
||||||
@foreach (var subskill in SubskillList)
|
|
||||||
{
|
|
||||||
<option value="@subskill.Id">@subskill.SubSkill</option>
|
|
||||||
}
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="text-center col">
|
|
||||||
<h4 class="mt-4">
|
|
||||||
<span class="text-muted">@lastS1score</span>
|
|
||||||
</h4>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Subskill 2 -->
|
|
||||||
<div class="d-flex justify-content-between align-items-center mt-3 row">
|
|
||||||
<div class="col">
|
|
||||||
<label for="subskillSelect2">Select Level 25 Subskill</label>
|
|
||||||
<select id="subskillSelect2" class="form-control" @bind="Subskill2">
|
|
||||||
<option value="" disabled selected>Choose Subskill...</option>
|
|
||||||
@foreach (var subskill in SubskillList)
|
|
||||||
{
|
|
||||||
<option value="@subskill.Id">@subskill.SubSkill</option>
|
|
||||||
}
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="text-center col">
|
|
||||||
<h4 class="mt-4">
|
|
||||||
<span class="text-muted">@lastS2score</span>
|
|
||||||
</h4>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Subskill 3 -->
|
|
||||||
<div class="d-flex justify-content-between align-items-center mt-3 row">
|
|
||||||
<div class="col">
|
|
||||||
<label for="subskillSelect3">Select Level 50 Subskill</label>
|
|
||||||
<select id="subskillSelect3" class="form-control" @bind="Subskill3">
|
|
||||||
<option value="" selected disabled>Choose Subskill...</option>
|
|
||||||
@foreach (var subskill in SubskillList)
|
|
||||||
{
|
|
||||||
<option value="@subskill.Id">@subskill.SubSkill</option>
|
|
||||||
}
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="text-center col">
|
|
||||||
<h4 class="mt-4">
|
|
||||||
<span class="text-muted">@lastS3score</span>
|
|
||||||
</h4>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Subskill 4 Disabled -->
|
|
||||||
<div class="d-flex justify-content-between align-items-center mt-3 row">
|
|
||||||
<div class="col">
|
|
||||||
<label for="subskillSelect4">Select Level 75 Subskill</label>
|
|
||||||
<select id="subskillSelect4" disabled class="form-control" @bind="Subskill4">
|
|
||||||
<option value="" disabled selected>Choose Subskill...</option>
|
|
||||||
@foreach (var subskill in SubskillList)
|
|
||||||
{
|
|
||||||
<option value="@subskill.Id">@subskill.SubSkill</option>
|
|
||||||
}
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="text-center col">
|
|
||||||
<h4 class="mt-4">
|
|
||||||
<span class="text-muted">0</span>
|
|
||||||
</h4>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Subskill 5 Disabled -->
|
|
||||||
<div class="d-flex justify-content-between align-items-center mt-3 row">
|
|
||||||
<div class="col">
|
|
||||||
<label for="subskillSelect5">Select Level 100 Subskill</label>
|
|
||||||
<select id="subskillSelect5" disabled class="form-control mb-2" @bind="Subskill5">
|
|
||||||
<option value="" disabled selected>Choose Subskill...</option>
|
|
||||||
@foreach (var subskill in SubskillList)
|
|
||||||
{
|
|
||||||
<option value="@subskill.Id">@subskill.SubSkill</option>
|
|
||||||
}
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="text-center col">
|
|
||||||
<h4 class="mt-4">
|
|
||||||
<span class="text-muted">0</span>
|
|
||||||
</h4>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<hr/>
|
|
||||||
|
|
||||||
<!-- Score Output -->
|
|
||||||
<div class="d-flex justify-content-between align-items-center mt-3 row">
|
|
||||||
<h3 class="col">Final Score:</h3>
|
|
||||||
<div class="p-2 rounded text-center col"
|
|
||||||
style="background-color:@ScoreBackgroundColor; color:@ScoreColor; ">
|
|
||||||
<h3>@FinalScore</h3>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
@ -1,156 +0,0 @@
|
||||||
using Microsoft.AspNetCore.Components;
|
|
||||||
using Portfolio.Domain.Features.Pokemon;
|
|
||||||
using Portfolio.Domain.Features.Pokemon_Natures;
|
|
||||||
using Portfolio.Domain.Features.Pokemon_Subskills;
|
|
||||||
|
|
||||||
namespace Portfolio.WebUI.Server.Components.Component.Pokemon_Components
|
|
||||||
{
|
|
||||||
partial class PokemonRatingPanel
|
|
||||||
{
|
|
||||||
[Parameter] public Pokemon PokemonToRate { get; set; }
|
|
||||||
[Parameter] public List<PokemonNature> NatureList { get; set; } = new();
|
|
||||||
[Parameter] public List<PokemonSubskill> SubskillList { get; set; } = new();
|
|
||||||
|
|
||||||
private int SelectedNatureId;
|
|
||||||
private int Subskill1;
|
|
||||||
private int Subskill2;
|
|
||||||
private int Subskill3;
|
|
||||||
private int Subskill4;
|
|
||||||
private int Subskill5;
|
|
||||||
|
|
||||||
private int FinalScore;
|
|
||||||
private string ScoreBackgroundColor = "#FFFFFF";
|
|
||||||
private string ScoreColor = "#000000";
|
|
||||||
|
|
||||||
|
|
||||||
private int lastNatureId;
|
|
||||||
private int lastS1, lastS2, lastS3;
|
|
||||||
private int lastnaturescore, lastS1score, lastS2score, lastS3score;
|
|
||||||
|
|
||||||
protected override void OnAfterRender(bool firstRender)
|
|
||||||
{
|
|
||||||
// If last Nature or Subskill is different than previous
|
|
||||||
if (PokemonToRate != null) {
|
|
||||||
if (SelectedNatureId != lastNatureId)
|
|
||||||
{
|
|
||||||
lastNatureId = SelectedNatureId;
|
|
||||||
var nature = NatureList.FirstOrDefault(n => n.Id == lastNatureId);
|
|
||||||
lastnaturescore = PokemonToRate.Speciality switch
|
|
||||||
{
|
|
||||||
"Berries" => nature.BerryRating,
|
|
||||||
"Ingredients" => nature.IngredientRating,
|
|
||||||
"Skills" => nature.SkillRating,
|
|
||||||
_ => 0
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
if (Subskill1 != lastS1)
|
|
||||||
{
|
|
||||||
|
|
||||||
lastS1 = Subskill1;
|
|
||||||
var s1 = SubskillList.FirstOrDefault(s => s.Id == Subskill1);
|
|
||||||
lastS1score = PokemonToRate.Speciality switch
|
|
||||||
{
|
|
||||||
"Berries" => s1.BerryRank,
|
|
||||||
"Ingredients" => s1.IngredientRank,
|
|
||||||
"Skills" => s1.SkillRank,
|
|
||||||
_ => 0
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
if (Subskill2 != lastS2)
|
|
||||||
{
|
|
||||||
|
|
||||||
lastS2 = Subskill2;
|
|
||||||
var s2 = SubskillList.FirstOrDefault(s => s.Id == Subskill2);
|
|
||||||
lastS2score = PokemonToRate.Speciality switch
|
|
||||||
{
|
|
||||||
"Berries" => s2.BerryRank,
|
|
||||||
"Ingredients" => s2.IngredientRank,
|
|
||||||
"Skills" => s2.SkillRank,
|
|
||||||
_ => 0
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
if (Subskill3 != lastS3)
|
|
||||||
{
|
|
||||||
lastS3 = Subskill3;
|
|
||||||
var s3 = SubskillList.FirstOrDefault(s => s.Id == Subskill3);
|
|
||||||
lastS3score = PokemonToRate.Speciality switch
|
|
||||||
{
|
|
||||||
"Berries" => s3.BerryRank,
|
|
||||||
"Ingredients" => s3.IngredientRank,
|
|
||||||
"Skills" => s3.SkillRank,
|
|
||||||
_ => 0
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CalculateScore();
|
|
||||||
StateHasChanged();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void CalculateScore()
|
|
||||||
{
|
|
||||||
if (PokemonToRate == null || SelectedNatureId == 0 || lastS1 == 0 || lastS2 == 0 || lastS3 == 0)
|
|
||||||
{
|
|
||||||
|
|
||||||
FinalScore = 0;
|
|
||||||
ScoreBackgroundColor = "#FFFFFF";
|
|
||||||
ScoreColor = "#000000";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var nature = NatureList.FirstOrDefault(n => n.Id == SelectedNatureId);
|
|
||||||
var s1 = SubskillList.FirstOrDefault(s => s.Id == Subskill1);
|
|
||||||
var s2 = SubskillList.FirstOrDefault(s => s.Id == Subskill2);
|
|
||||||
var s3 = SubskillList.FirstOrDefault(s => s.Id == Subskill3);
|
|
||||||
|
|
||||||
if (nature == null || s1 == null || s2 == null || s3 == null)
|
|
||||||
{
|
|
||||||
FinalScore = 0;
|
|
||||||
ScoreBackgroundColor = "#FFFFFF";
|
|
||||||
ScoreColor = "#000000";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
FinalScore = PokemonToRate.Speciality switch
|
|
||||||
{
|
|
||||||
"Berries" => nature.BerryRating + s1.BerryRank + s2.BerryRank + s3.BerryRank,
|
|
||||||
"Ingredients" => nature.IngredientRating + s1.IngredientRank + s2.IngredientRank + s3.IngredientRank,
|
|
||||||
"Skills" => nature.SkillRating + s1.SkillRank + s2.SkillRank + s3.SkillRank,
|
|
||||||
_ => 0
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// Set score background based on value
|
|
||||||
ScoreBackgroundColor = FinalScore switch
|
|
||||||
{
|
|
||||||
8 => "#16C47F",
|
|
||||||
7 => "#33CB8F",
|
|
||||||
6 => "#50D39F",
|
|
||||||
5 => "#6DDAAF",
|
|
||||||
4 => "#8BE2BF",
|
|
||||||
3 => "#A8E9CF",
|
|
||||||
2 => "#C5F0DF",
|
|
||||||
1 => "#E2F8EF",
|
|
||||||
0 => "#FFFFFF",
|
|
||||||
-1 => "#FFE7E7",
|
|
||||||
-2 => "#FED0D0",
|
|
||||||
-3 => "#FEB8B8",
|
|
||||||
-4 => "#FDA0A0",
|
|
||||||
-5 => "#FD8888",
|
|
||||||
-6 => "#FC7171",
|
|
||||||
-7 => "#FC5959",
|
|
||||||
-8 => "#FB4141",
|
|
||||||
_ => "#FFFFFF"
|
|
||||||
};
|
|
||||||
|
|
||||||
ScoreColor = FinalScore == 0 ? "#000000" : "#FFFFFF";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,49 +0,0 @@
|
||||||
.pokemon-rating-panel {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 1.5rem;
|
|
||||||
width: 100%;
|
|
||||||
height: 70vh;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.ratings {
|
|
||||||
flex: 2;
|
|
||||||
padding: 1.5rem;
|
|
||||||
border-radius: 5% / 3.5%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.select-width {
|
|
||||||
width: 16rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.score-width {
|
|
||||||
width: 6rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@media (max-width: 768px) {
|
|
||||||
.pokemon-rating-panel {
|
|
||||||
padding: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ratings {
|
|
||||||
padding: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.d-flex.justify-content-between.align-items-center {
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: stretch !important;
|
|
||||||
gap: 0.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.select-width
|
|
||||||
{
|
|
||||||
width: 4rem;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.score-width h4 {
|
|
||||||
margin-top: 0.5rem !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
|
|
||||||
<!-- Search Input -->
|
|
||||||
<div class="pokemon-selector p-3 bg-light">
|
|
||||||
<input class="form-control mb-3 rounded rounded-5" placeholder="Search Pokémon..." @bind="SearchTerm" @oninput="HandleSearch" />
|
|
||||||
|
|
||||||
<!-- Scrollable Pokémon Grid -->
|
|
||||||
<div class="row pokemon-grid pt-1">
|
|
||||||
@foreach (var pokemon in FilteredPokemon)
|
|
||||||
{
|
|
||||||
bool isSelected = SelectedPokemon?.Id == pokemon.Id;
|
|
||||||
|
|
||||||
<div class="col-6 col-md-3 mb-3">
|
|
||||||
<div class="card pokemon-card small-card @(isSelected ? "border-primary border-2 shadow" : "border-2 border-white") rounded rounded-3"
|
|
||||||
@onclick="() => SelectPokemon(pokemon)">
|
|
||||||
<img src="@pokemon.PokemonImageUrl" class="card-img-top" style="height: 50px; object-fit: contain;" />
|
|
||||||
<div class="card-body p-2 text-center">
|
|
||||||
<small>@pokemon.PokemonId</small>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
@ -1,37 +0,0 @@
|
||||||
using Microsoft.AspNetCore.Components;
|
|
||||||
using Portfolio.Domain.Features.Pokemon;
|
|
||||||
|
|
||||||
namespace Portfolio.WebUI.Server.Components.Component.Pokemon_Components
|
|
||||||
{
|
|
||||||
partial class PokemonSelector
|
|
||||||
{
|
|
||||||
|
|
||||||
[Parameter]
|
|
||||||
public List<Pokemon> PokemonList { get; set; } = new();
|
|
||||||
|
|
||||||
[Parameter]
|
|
||||||
public Pokemon? SelectedPokemon { get; set; }
|
|
||||||
|
|
||||||
[Parameter]
|
|
||||||
public EventCallback<Pokemon> OnPokemonSelected { get; set; }
|
|
||||||
|
|
||||||
private string SearchTerm { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
private List<Pokemon> FilteredPokemon =>
|
|
||||||
string.IsNullOrWhiteSpace(SearchTerm)
|
|
||||||
? PokemonList
|
|
||||||
: PokemonList.Where(p =>
|
|
||||||
p.PokemonName.Contains(SearchTerm, StringComparison.OrdinalIgnoreCase)).ToList();
|
|
||||||
|
|
||||||
private async Task HandleSearch(ChangeEventArgs e)
|
|
||||||
{
|
|
||||||
SearchTerm = e?.Value?.ToString() ?? "";
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task SelectPokemon(Pokemon pokemon)
|
|
||||||
{
|
|
||||||
await OnPokemonSelected.InvokeAsync(pokemon);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
||||||
.pokemon-selector {
|
|
||||||
height: 70vh;
|
|
||||||
width: 20vw;
|
|
||||||
border: 1px solid #ccc;
|
|
||||||
border-radius: 5% / 3.5%;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
.pokemon-grid {
|
|
||||||
flex: 1 1 auto;
|
|
||||||
overflow-y: auto;
|
|
||||||
align-content: flex-start;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.pokemon-card {
|
|
||||||
cursor: pointer;
|
|
||||||
transition: transform 0.15s ease-in-out;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pokemon-card:hover {
|
|
||||||
transform: scale(1.13);
|
|
||||||
}
|
|
||||||
|
|
||||||
.small-card {
|
|
||||||
font-size: 0.75rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,372 +0,0 @@
|
||||||
@inject IPokemonService PokemonService
|
|
||||||
@inject IJSRuntime JS
|
|
||||||
@inject NavigationManager Navigation
|
|
||||||
|
|
||||||
@attribute [StreamRendering]
|
|
||||||
@rendermode InteractiveServer
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Table A: Desktop View-->
|
|
||||||
<div class="container d-none d-lg-block d-md-none mt-4">
|
|
||||||
<!-- Main UI -->
|
|
||||||
<div class="border-0 mx-auto col-8 ">
|
|
||||||
<!-- UI Header -->
|
|
||||||
<div class="row bg-secondary py-3 border-0 rounded-top">
|
|
||||||
<div class="d-flex align-items-center justify-content-between w-100 position-relative px-3">
|
|
||||||
|
|
||||||
<!-- Left: Search -->
|
|
||||||
<input class="form-control w-25 me-3 rounded rounded-5"
|
|
||||||
placeholder="Search Pokémon..."
|
|
||||||
@bind="SearchTerm"
|
|
||||||
@oninput="HandleSearch" />
|
|
||||||
|
|
||||||
<!-- Center: Title -->
|
|
||||||
<h2 class="text-white mb-0 position-absolute start-50 translate-middle-x">
|
|
||||||
Available Pokémon
|
|
||||||
</h2>
|
|
||||||
|
|
||||||
<!-- Right: Count + Download -->
|
|
||||||
<div class="d-flex align-items-center gap-2">
|
|
||||||
<div class="badge bg-light">
|
|
||||||
<p class="statText text-primary fw-medium shadow mb-0">@(pokemons.Count()) Pokémon</p>
|
|
||||||
</div>
|
|
||||||
<PokemonDownloadButton _Pokemon="pokemons" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Table -->
|
|
||||||
<div class="tableFixHead d-flex flex-column justify-content-start bg-secondary table-responsive row ">
|
|
||||||
<table class="table table-borderless border-0 table-secondary table-striped align-middle">
|
|
||||||
<!-- Table Head -->
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th class="text-white text-bg-info col-2" scope="col"></th>
|
|
||||||
<th class="text-white text-bg-info col-1" scope="col">#</th>
|
|
||||||
<th class="text-white text-bg-info col-2" scope="col">Pokémon</th>
|
|
||||||
<th class="text-white text-bg-info col-1 text-center" scope="col">Type</th>
|
|
||||||
<th class="text-white text-bg-info col-1 text-center" scope="col">Sleep Type</th>
|
|
||||||
<th class="text-white text-bg-info col-1 text-center" scope="col">Speciality</th>
|
|
||||||
@if (adminToggle)
|
|
||||||
{
|
|
||||||
<th class="text-white text-bg-info col-2 text-center" scope="col">Admin</th>
|
|
||||||
|
|
||||||
}
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<!-- If/Else Pokemon Loaded-->
|
|
||||||
@if(pokemons == null)
|
|
||||||
{
|
|
||||||
<tbody>
|
|
||||||
<Loading />
|
|
||||||
</tbody>
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
<!-- Table Body -->
|
|
||||||
<tbody>
|
|
||||||
@if (FilteredPokemon != null && FilteredPokemon.Any())
|
|
||||||
{
|
|
||||||
@foreach (var pokemon in FilteredPokemon)
|
|
||||||
{
|
|
||||||
<tr>
|
|
||||||
<!-- Section 1: Pokemon Image -->
|
|
||||||
<td class="pokeimage">
|
|
||||||
<PokemonImage baseUrl="@pokemon.PokemonImageUrl" shinyUrl="@pokemon.PokemonShinyImageUrl" />
|
|
||||||
</td>
|
|
||||||
|
|
||||||
<!-- Section 2: Pokemon # -->
|
|
||||||
<th scope="row" style="cursor: default;">@pokemon.PokemonId</th>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Section 3: Pokemon Name -->
|
|
||||||
<td @onclick="() => ViewPokemon(pokemon.PokemonId)" class="pokemon-name-style fw-light col-2">@(pokemon.IsVariation && ToggleVariationName(pokemon.Id, pokemon.PokemonId) ? $"{pokemon.VariationName} {pokemon.PokemonName}" : pokemon.PokemonName)</td>
|
|
||||||
|
|
||||||
<!-- Section 4: Pokemon Type -->
|
|
||||||
<td>
|
|
||||||
<div class="d-flex justify-content-center">
|
|
||||||
<img src="@GetTypeImageUrl(pokemon.PokemonType)" style="width:36px; height:36px;box-shadow: 0 1px 2px 1px rgba(0,0,0,0.35);border-radius: 20px;" />
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
|
|
||||||
<!-- Section 5: Sleep Type -->
|
|
||||||
<td>
|
|
||||||
<div class="d-flex justify-content-center ">
|
|
||||||
<PokemonBadge BadgeItem="@pokemon.SleepType" />
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
|
|
||||||
<!-- Section 6: Speciality -->
|
|
||||||
<td>
|
|
||||||
<div class="d-flex justify-content-center">
|
|
||||||
<PokemonBadge BadgeItem="@pokemon.Speciality" />
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
|
|
||||||
<!-- Section 7: Admin Controls -->
|
|
||||||
@if (adminToggle)
|
|
||||||
{
|
|
||||||
<td>
|
|
||||||
<div class="d-flex justify-content-center gap-1">
|
|
||||||
<PokemonEditButton PokemonId="@pokemon.PokemonId" />
|
|
||||||
<button class="btn btn-danger rounded rounded-5 text-white " @onclick="() => ConfirmDelete(pokemon.Id)">
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-trash3-fill" viewBox="0 0 16 16">
|
|
||||||
<path d="M11 1.5v1h3.5a.5.5 0 0 1 0 1h-.538l-.853 10.66A2 2 0 0 1 11.115 16h-6.23a2 2 0 0 1-1.994-1.84L2.038 3.5H1.5a.5.5 0 0 1 0-1H5v-1A1.5 1.5 0 0 1 6.5 0h3A1.5 1.5 0 0 1 11 1.5m-5 0v1h4v-1a.5.5 0 0 0-.5-.5h-3a.5.5 0 0 0-.5.5M4.5 5.029l.5 8.5a.5.5 0 1 0 .998-.06l-.5-8.5a.5.5 0 1 0-.998.06m6.53-.528a.5.5 0 0 0-.528.47l-.5 8.5a.5.5 0 0 0 .998.058l.5-8.5a.5.5 0 0 0-.47-.528M8 4.5a.5.5 0 0 0-.5.5v8.5a.5.5 0 0 0 1 0V5a.5.5 0 0 0-.5-.5" />
|
|
||||||
</svg>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
}
|
|
||||||
|
|
||||||
</tr>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
<tr>
|
|
||||||
<td colspan="100%">
|
|
||||||
<div class="d-flex justify-content-center align-items-center" style="height: 200px;">
|
|
||||||
<p class="text-muted">Pokémon could not be found.</p>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
}
|
|
||||||
</tbody>
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
</table>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!-- Wrap in Auth -->
|
|
||||||
<div class="d-flex justify-content-end mt-1">
|
|
||||||
<div class="form-check form-switch">
|
|
||||||
<input class="form-check-input rounded rounded-3" type="checkbox" role="switch" id="flexSwitchCheckDefault" @bind="adminToggle">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="container d-none d-lg-none d-md-block mt-4">
|
|
||||||
<!-- Main UI -->
|
|
||||||
<div class="border-0 mx-auto col-8 ">
|
|
||||||
<!-- UI Header -->
|
|
||||||
<div class="row bg-secondary py-3 border-0 rounded-top">
|
|
||||||
<div class="d-flex flex-row align-items-center justify-content-between w-100 gap-3 ms-0 me-0">
|
|
||||||
<div class="col">
|
|
||||||
<input class="form-control rounded rounded-5 fs-6 fw-lighter"
|
|
||||||
placeholder="Search Pokémon..."
|
|
||||||
@bind="SearchTerm"
|
|
||||||
@oninput="HandleSearch" />
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!-- Left: Search -->
|
|
||||||
|
|
||||||
<!-- Center: Title -->
|
|
||||||
<div class="col">
|
|
||||||
<h2 class="text-white text-center pt-2 fs-6 fw-light">
|
|
||||||
Available Pokémon
|
|
||||||
</h2>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Right: Count + Download -->
|
|
||||||
<div class="col">
|
|
||||||
<div class="d-flex align-items-center gap-1">
|
|
||||||
<div class="badge bg-light">
|
|
||||||
<p class="statText text-primary fw-medium shadow mb-0">@(pokemons.Count()) Pokémon</p>
|
|
||||||
</div>
|
|
||||||
<PokemonDownloadButton _Pokemon="pokemons" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Table -->
|
|
||||||
<div class="tableFixHead d-flex flex-column justify-content-start bg-secondary table-responsive row ">
|
|
||||||
<table class="table table-borderless border-0 table-secondary table-striped align-middle">
|
|
||||||
<!-- Table Head -->
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th class="text-white text-bg-info col-2" scope="col"></th>
|
|
||||||
<th class="text-white text-bg-info col-1" scope="col">#</th>
|
|
||||||
<th class="text-white text-bg-info col-2" scope="col">Pokémon</th>
|
|
||||||
<th class="text-white text-bg-info col-1 text-center" scope="col">Type</th>
|
|
||||||
<th class="text-white text-bg-info col-1 text-center" scope="col">Sleep Type</th>
|
|
||||||
<th class="text-white text-bg-info col-1 text-center" scope="col">Speciality</th>
|
|
||||||
@if (adminToggle)
|
|
||||||
{
|
|
||||||
<th class="text-white text-bg-info col-2 text-center" scope="col">Admin</th>
|
|
||||||
|
|
||||||
}
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<!-- If/Else Pokemon Loaded-->
|
|
||||||
@if (pokemons == null)
|
|
||||||
{
|
|
||||||
<tbody>
|
|
||||||
<Loading />
|
|
||||||
</tbody>
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
<!-- Table Body -->
|
|
||||||
<tbody>
|
|
||||||
@if (FilteredPokemon != null && FilteredPokemon.Any())
|
|
||||||
{
|
|
||||||
@foreach (var pokemon in FilteredPokemon)
|
|
||||||
{
|
|
||||||
<tr>
|
|
||||||
<!-- Section 1: Pokemon Image -->
|
|
||||||
<td class="">
|
|
||||||
<img src="@pokemon.PokemonImageUrl" style="width:100px;" />
|
|
||||||
</td>
|
|
||||||
|
|
||||||
<!-- Section 2: Pokemon # -->
|
|
||||||
<th scope="row" style="cursor: default;">@pokemon.PokemonId</th>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Section 3: Pokemon Name -->
|
|
||||||
<td @onclick="() => ViewPokemon(pokemon.PokemonId)" class="pokemon-name-style fw-light col-2">@(pokemon.IsVariation && ToggleVariationName(pokemon.Id, pokemon.PokemonId) ? $"{pokemon.VariationName} {pokemon.PokemonName}" : pokemon.PokemonName)</td>
|
|
||||||
|
|
||||||
<!-- Section 4: Pokemon Type -->
|
|
||||||
<td>
|
|
||||||
<div class="d-flex justify-content-center">
|
|
||||||
<img src="@GetTypeImageUrl(pokemon.PokemonType)" style="width:36px; height:36px;" />
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
|
|
||||||
<!-- Section 5: Sleep Type -->
|
|
||||||
<td>
|
|
||||||
<div class="d-flex justify-content-center ">
|
|
||||||
<PokemonBadge BadgeItem="@pokemon.SleepType" />
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
|
|
||||||
<!-- Section 6: Speciality -->
|
|
||||||
<td>
|
|
||||||
<div class="d-flex justify-content-center">
|
|
||||||
<PokemonBadge BadgeItem="@pokemon.Speciality" />
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
|
|
||||||
<!-- Section 7: Admin Controls -->
|
|
||||||
@if (adminToggle)
|
|
||||||
{
|
|
||||||
<td>
|
|
||||||
<div class="d-flex justify-content-center gap-1">
|
|
||||||
<PokemonEditButton PokemonId="@pokemon.PokemonId" />
|
|
||||||
<button class="btn btn-danger rounded rounded-5 text-white " @onclick="() => ConfirmDelete(pokemon.Id)">
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-trash3-fill" viewBox="0 0 16 16">
|
|
||||||
<path d="M11 1.5v1h3.5a.5.5 0 0 1 0 1h-.538l-.853 10.66A2 2 0 0 1 11.115 16h-6.23a2 2 0 0 1-1.994-1.84L2.038 3.5H1.5a.5.5 0 0 1 0-1H5v-1A1.5 1.5 0 0 1 6.5 0h3A1.5 1.5 0 0 1 11 1.5m-5 0v1h4v-1a.5.5 0 0 0-.5-.5h-3a.5.5 0 0 0-.5.5M4.5 5.029l.5 8.5a.5.5 0 1 0 .998-.06l-.5-8.5a.5.5 0 1 0-.998.06m6.53-.528a.5.5 0 0 0-.528.47l-.5 8.5a.5.5 0 0 0 .998.058l.5-8.5a.5.5 0 0 0-.47-.528M8 4.5a.5.5 0 0 0-.5.5v8.5a.5.5 0 0 0 1 0V5a.5.5 0 0 0-.5-.5" />
|
|
||||||
</svg>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
}
|
|
||||||
|
|
||||||
</tr>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
<tr>
|
|
||||||
<td colspan="100%">
|
|
||||||
<div class="d-flex justify-content-center align-items-center" style="height: 200px;">
|
|
||||||
<p class="text-muted">Pokémon could not be found.</p>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
}
|
|
||||||
</tbody>
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
</table>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!-- Wrap in Auth -->
|
|
||||||
<div class="d-flex justify-content-end mt-1">
|
|
||||||
<div class="form-check form-switch">
|
|
||||||
<input class="form-check-input rounded rounded-3" type="checkbox" role="switch" id="flexSwitchCheckDefault" @bind="adminToggle">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Desktop B: Mobile View -->
|
|
||||||
@* <div class="container card border-0 d-block d-md-none mx-auto mt-4 shadow-sm">
|
|
||||||
<!-- Table Header -->
|
|
||||||
<div class="row card-header bg-secondary bg-gradient ml-0 py-3 border-0 bg-info">
|
|
||||||
<div class="flex-row justify-content-between">
|
|
||||||
<div class="text-center position-relative">
|
|
||||||
<h2 class="text-white text-decoration-underline">Pokémon</h2>
|
|
||||||
<div class="m-1 badge bg-white text-info position-absolute top-0 end-0 border-0 w-auto"><p class="statText">@(pokemons.Count()) Pokémon</p></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- Table Body -->
|
|
||||||
<div class="tableFixHead row">
|
|
||||||
<table class="table table-striped border-0">
|
|
||||||
|
|
||||||
|
|
||||||
<tbody>
|
|
||||||
@if (pokemons == null)
|
|
||||||
{
|
|
||||||
<Loading />
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
@foreach (var pokemon in pokemons)
|
|
||||||
{
|
|
||||||
<tr class="border-0">
|
|
||||||
<div class="d-flex align-items-center" style="border: 1px dashed hotpink;">
|
|
||||||
|
|
||||||
<!-- Pokemon Image -->
|
|
||||||
<div class="me-3" style="border: 1px dashed hotpink;">
|
|
||||||
<div class="flip-container-sm" @onclick="() => ToggleImage(pokemon.Id)">
|
|
||||||
<div class="flipper-sm @(isShiny[pokemon.Id] ? "flipped" : "")">
|
|
||||||
<img class="front img-fluid" src="@pokemon.PokemonImageUrl" />
|
|
||||||
@if (pokemon.PokemonShinyImageUrl != null)
|
|
||||||
{
|
|
||||||
<img class="back img-fluid" src="@pokemon.PokemonShinyImageUrl" />
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div style="border: 1px dashed hotpink;">
|
|
||||||
<!-- Number and Name -->
|
|
||||||
<h5>
|
|
||||||
@pokemon.PokemonId -
|
|
||||||
<span class="pokemon-name-style fw-light" @onclick="() => ViewPokemon(pokemon.PokemonId)">
|
|
||||||
@(pokemon.IsVariation && ToggleVariationName(pokemon.Id, pokemon.PokemonId) ? $"{pokemon.VariationName} {pokemon.PokemonName}" : pokemon.PokemonName)
|
|
||||||
</span>
|
|
||||||
</h5>
|
|
||||||
<!-- Stats -->
|
|
||||||
<div class="d-flex flex-wrap align-items-center gap-2">
|
|
||||||
<img src="@GetTypeImageUrl(pokemon.PokemonType)" style="width:28px;" />
|
|
||||||
<PokemonBadge BadgeItem="@pokemon.SleepType" />
|
|
||||||
<PokemonBadge BadgeItem="@pokemon.Speciality" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</tr>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div> *@
|
|
||||||
|
|
@ -1,92 +0,0 @@
|
||||||
using Microsoft.AspNetCore.Components;
|
|
||||||
using Microsoft.EntityFrameworkCore.Metadata.Internal;
|
|
||||||
using Microsoft.JSInterop;
|
|
||||||
using Portfolio.Domain.Features.Pokemon;
|
|
||||||
using System.Text.Json;
|
|
||||||
|
|
||||||
namespace Portfolio.WebUI.Server.Components.Component.Pokemon_Components
|
|
||||||
{
|
|
||||||
public partial class PokemonTable
|
|
||||||
{
|
|
||||||
[Parameter]
|
|
||||||
public List<Pokemon> AllPokemon { get; set; }
|
|
||||||
|
|
||||||
private List<Pokemon> pokemons = new List<Pokemon>();
|
|
||||||
|
|
||||||
private bool adminToggle = false;
|
|
||||||
|
|
||||||
|
|
||||||
protected override void OnParametersSet()
|
|
||||||
{
|
|
||||||
if (AllPokemon != null) {
|
|
||||||
pokemons = AllPokemon.ToList();
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private string SearchTerm { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
private List<Pokemon> FilteredPokemon =>
|
|
||||||
string.IsNullOrWhiteSpace(SearchTerm)
|
|
||||||
? AllPokemon
|
|
||||||
: AllPokemon.Where(p =>
|
|
||||||
p.PokemonName.Contains(SearchTerm, StringComparison.OrdinalIgnoreCase)).ToList();
|
|
||||||
|
|
||||||
private async Task HandleSearch(ChangeEventArgs e)
|
|
||||||
{
|
|
||||||
SearchTerm = e?.Value?.ToString() ?? "";
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool ToggleVariationName(int Id, int PokemonId)
|
|
||||||
{
|
|
||||||
foreach (var pokemon in pokemons)
|
|
||||||
{
|
|
||||||
if (pokemon.PokemonId == PokemonId && pokemon.Id != Id)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task ConfirmDelete(int Id)
|
|
||||||
{
|
|
||||||
bool confirm = await JS.InvokeAsync<bool>("confirm", "Are you sure you want to delete this Pokémon?");
|
|
||||||
if (confirm)
|
|
||||||
{
|
|
||||||
await DeletePokemon(Id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task DeletePokemon(int Id)
|
|
||||||
{
|
|
||||||
await PokemonService.DeletePokemonAsync(Id);
|
|
||||||
pokemons.RemoveAll(p => p.Id == Id); // Remove from the list locally
|
|
||||||
StateHasChanged(); // Refresh the UI
|
|
||||||
}
|
|
||||||
|
|
||||||
private void EditPokemon(int id)
|
|
||||||
{
|
|
||||||
Navigation.NavigateTo($"/pokemon-sleep/edit/{id}");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ViewPokemon(int id)
|
|
||||||
{
|
|
||||||
Navigation.NavigateTo($"/pokemon-sleep/pokemon/{id}");
|
|
||||||
}
|
|
||||||
|
|
||||||
private string GetTypeImageUrl(string pokemonType)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(pokemonType))
|
|
||||||
{
|
|
||||||
return "https://www.serebii.net/pokemonsleep/pokemon/type/normal.png"; // Fallback image
|
|
||||||
}
|
|
||||||
|
|
||||||
return $"https://www.serebii.net/pokemonsleep/pokemon/type/{pokemonType.ToLower()}.png";
|
|
||||||
}
|
|
||||||
|
|
||||||
private void HandleToggleChange(ChangeEventArgs e)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"Admin Toggle is now: {adminToggle}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,122 +0,0 @@
|
||||||
.five-percent {
|
|
||||||
width: 5%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ten-percent {
|
|
||||||
width: 10%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pokemontable {
|
|
||||||
height: 65vh;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tableFixHead {
|
|
||||||
overflow: auto;
|
|
||||||
height: 600px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tableFixHead thead th {
|
|
||||||
position: sticky;
|
|
||||||
top: 0;
|
|
||||||
z-index: 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
.align-top-tbody {
|
|
||||||
vertical-align: top;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pokemon-name-style {
|
|
||||||
cursor: pointer;
|
|
||||||
font-size: 1.3rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.flip-container {
|
|
||||||
perspective: 1000px;
|
|
||||||
display: inline-block;
|
|
||||||
width: 90px;
|
|
||||||
height: 90px;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.flipper {
|
|
||||||
transition: transform 0.6s;
|
|
||||||
transform-style: preserve-3d;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
.flipped {
|
|
||||||
transform: rotateY(180deg);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.flip-container-sm {
|
|
||||||
perspective: 1000px;
|
|
||||||
width: 64px;
|
|
||||||
height: 64px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.flipper-sm {
|
|
||||||
transition: 0.6s;
|
|
||||||
transform-style: preserve-3d;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
.flipper-sm img {
|
|
||||||
backface-visibility: hidden;
|
|
||||||
position: absolute;
|
|
||||||
width: 64px;
|
|
||||||
height: 64px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.flipper-sm .front {
|
|
||||||
z-index: 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
.flipper-sm .back {
|
|
||||||
transform: rotateY(180deg);
|
|
||||||
}
|
|
||||||
|
|
||||||
.flipper-sm.flipped {
|
|
||||||
transform: rotateY(180deg);
|
|
||||||
}
|
|
||||||
|
|
||||||
.fixed-row-height {
|
|
||||||
height: 90px; /* or any height that suits your card style */
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.badge {
|
|
||||||
width: 100px;
|
|
||||||
height: 30px;
|
|
||||||
color: white;
|
|
||||||
padding: 4px 8px;
|
|
||||||
text-align: center;
|
|
||||||
vertical-align: middle;
|
|
||||||
border-radius: 30px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.statText {
|
|
||||||
position: relative;
|
|
||||||
top: 50%;
|
|
||||||
left: 50%;
|
|
||||||
transform: translate(-50%, -50%);
|
|
||||||
font-size: 13px;
|
|
||||||
cursor: default;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pokeimage {
|
|
||||||
width: 100px;
|
|
||||||
height: 130px;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue