correct some errors 🐛
continuous-integration/drone/push Build is failing Details

ApiManager
Emre KARTAL 2 years ago
parent 43cf7792e6
commit 91c36e266c

Binary file not shown.

@ -1,5 +1,6 @@
using Microsoft.AspNetCore.Mvc.ApiExplorer;
using Microsoft.AspNetCore.Mvc.Versioning;
using Microsoft.OpenApi.Models;
using Model;
var builder = WebApplication.CreateBuilder(args);
@ -9,7 +10,11 @@ var builder = WebApplication.CreateBuilder(args);
builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
builder.Services.AddSwaggerGen(options =>
{
options.SwaggerDoc("v1", new OpenApiInfo { Title = "My API v1", Version = "v1" });
options.SwaggerDoc("v2", new OpenApiInfo { Title = "My API v2", Version = "v2" });
});
builder.Services.AddApiVersioning(opt =>

@ -21,14 +21,15 @@ namespace Client
public async Task<IEnumerable<ChampionDto>> GetChampion(int index, int count)
{
var url = $"{UrlApiChampions}?index={index}&count={count}";
return await _httpClient.GetFromJsonAsync<IEnumerable<ChampionDto>>(url);
var Response = await _httpClient.GetFromJsonAsync<PageResponse<ChampionDto>>(url);
return Response.Data;
}
/* public async void Add(ChampionDto champion)
/* public async void Add(ChampionDto champion)
{
await _httpClient.PostAsJsonAsync<ChampionDto>(ApiChampions, champion);
}*/
/* public async void Delete(ChampionDto champion)
/* public async void Delete(ChampionDto champion)
{
await _httpClient.DeleteAsync(champion.Name);
}

@ -35,3 +35,5 @@ if (championToUpdate != null)
}
*/
Console.ReadLine();

@ -1,4 +1,5 @@
using DbManager.Mapper;
using Microsoft.EntityFrameworkCore;
using Model;
namespace DbLib
@ -40,22 +41,22 @@ namespace DbLib
= (rune, substring) => rune.Name.Contains(substring, StringComparison.InvariantCultureIgnoreCase);
public async Task<IEnumerable<Rune?>> GetItemByName(string substring, int index, int count, string? orderingPropertyName = null, bool descending = false)
=> parent.DbContext.Runes.GetItemsWithFilterAndOrdering(
=> parent.DbContext.Runes.Include(r => r.Image).GetItemsWithFilterAndOrdering(
rune => filterByName(rune.ToModel(), substring),
index, count, orderingPropertyName, descending).Select(c => c.ToModel());
public async Task<IEnumerable<Rune?>> GetItems(int index, int count, string? orderingPropertyName = null, bool descending = false)
=> parent.DbContext.Runes.GetItemsWithFilterAndOrdering(
=> parent.DbContext.Runes.Include(r => r.Image).GetItemsWithFilterAndOrdering(
r => true,
index, count, orderingPropertyName, descending).Select(c => c.ToModel());
public async Task<IEnumerable<Rune?>> GetItemsByFamily(RuneFamily family, int index, int count, string? orderingPropertyName = null, bool descending = false)
=> parent.DbContext.Runes.GetItemsWithFilterAndOrdering(
=> parent.DbContext.Runes.Include(r => r.Image).GetItemsWithFilterAndOrdering(
rune => filterByRuneFamily(rune.ToModel(), family),
index, count, orderingPropertyName, descending).Select(c => c.ToModel());
public async Task<IEnumerable<Rune?>> GetItemsByName(string substring, int index, int count, string? orderingPropertyName = null, bool descending = false)
=> parent.DbContext.Runes.GetItemsWithFilterAndOrdering(
=> parent.DbContext.Runes.Include(r => r.Image).GetItemsWithFilterAndOrdering(
rune => filterByNameContains(rune.ToModel(), substring),
index, count, orderingPropertyName, descending).Select(c => c.ToModel());

@ -6,7 +6,7 @@ namespace DbManager.Mapper
{
public static class RuneMapper
{
public static Rune ToModel(this RuneEntity rune) => new(rune.Name, rune.Family.ToModel(), rune.Icon, "", rune.Description);
public static Rune ToModel(this RuneEntity rune) => new(rune.Name, rune.Family.ToModel(), rune.Icon, rune.Image.Base64, rune.Description);
public static RuneEntity ToEntity(this Rune rune)
=> new()
{

@ -21,7 +21,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DTO", "DTO\DTO.csproj", "{3
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApiTests", "Tests\ApiTests\ApiTests.csproj", "{1779D8A4-2E12-47F3-BDA2-2E7F04B758EB}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Client", "Client\Client.csproj", "{464DAB04-BE65-429D-9A39-3E1BB43C521A}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApiManager", "Client\ApiManager.csproj", "{464DAB04-BE65-429D-9A39-3E1BB43C521A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MyFlib", "MyFlib\MyFlib.csproj", "{2142AB69-B483-4B0A-96DC-CFA87DEB11A5}"
EndProject

Loading…
Cancel
Save