Compare commits

...

20 Commits

Author SHA1 Message Date
Patrick BRUGIERE 089082f111 tentive correction add api
continuous-integration/drone/push Build is passing Details
1 year ago
Antoine JOURDAIN 4f67b0bf0e enlever api
continuous-integration/drone/push Build is passing Details
1 year ago
Antoine JOURDAIN 696a0bec00 dev
continuous-integration/drone/push Build is passing Details
1 year ago
Antoine JOURDAIN a09eab26ae Fusionnnn
continuous-integration/drone/push Build is passing Details
1 year ago
Antoine JOURDAIN 50da11c8c1 Ajout vocabulaire
continuous-integration/drone/push Build is passing Details
1 year ago
Antoine JOURDAIN f414f8c385 Vocabulaire fonctionnel :)
continuous-integration/drone/push Build is passing Details
1 year ago
Antoine JOURDAIN 095eecaaef dev
continuous-integration/drone/push Build is failing Details
1 year ago
Antoine JOURDAIN 6323707179 dev
1 year ago
Patrick BRUGIERE e13ce59447 legere modif de la page de modification
continuous-integration/drone/push Build is passing Details
1 year ago
Antoine JOURDAIN 8bbc76c255 shit commit for future dev
continuous-integration/drone/push Build is passing Details
1 year ago
Antoine JOURDAIN 276d9668f2 Merge branch 'blazor' of https://codefirst.iut.uca.fr/git/antoine.jourdain/SAE_2A_Anglais into blazor
continuous-integration/drone/push Build is passing Details
1 year ago
Antoine JOURDAIN 4398571200 Déblayage pour taff
1 year ago
Patrick BRUGIERE 5786ee0e54 legere modif
continuous-integration/drone/push Build is failing Details
1 year ago
Antoine JOURDAIN 78954ae3d3 test encore
continuous-integration/drone/push Build is passing Details
1 year ago
Antoine JOURDAIN 6ca57fb022 Revert "Encore un test docker..."
continuous-integration/drone/push Build is passing Details
1 year ago
Antoine JOURDAIN 6163f7d4cf test
continuous-integration/drone/push Build is passing Details
1 year ago
Antoine JOURDAIN 7fc82cf752 Encore un test docker...
continuous-integration/drone/push Build is passing Details
1 year ago
Antoine JOURDAIN 0221c0da46 Try fixing la CI
continuous-integration/drone/push Build is passing Details
1 year ago
Antoine JOURDAIN e26be60eb5 test ci
continuous-integration/drone/push Build is passing Details
1 year ago
Antoine JOURDAIN cedecba357 Test CI
continuous-integration/drone/push Build is passing Details
1 year ago

@ -74,6 +74,7 @@ steps:
CONTAINERNAME: api-in-english-please CONTAINERNAME: api-in-english-please
COMMAND: create COMMAND: create
OVERWRITE: true OVERWRITE: true
CODEFIRST_CLIENTDRONE_ENV_BASE_PATH: /containers/antoinejourdain-api-in-english-please/
depends_on: [ docker-build-api ] depends_on: [ docker-build-api ]
when: when:
branch: branch:
@ -103,6 +104,7 @@ steps:
CONTAINERNAME: in-english-please CONTAINERNAME: in-english-please
COMMAND: create COMMAND: create
OVERWRITE: true OVERWRITE: true
CODEFIRST_CLIENTDRONE_ENV_BASE_PATH: /containers/antoinejourdain-in-english-please/
depends_on: [ docker-build-app ] depends_on: [ docker-build-app ]
when: when:
branch: branch:

@ -34,7 +34,7 @@ namespace Minecraft.Crafting.Api.Controllers
/// <param name="item">The item.</param> /// <param name="item">The item.</param>
/// <returns>The async task.</returns> /// <returns>The async task.</returns>
[HttpPost] [HttpPost]
[Route("")] [Route("add")]
public Task Add(User item) public Task Add(User item)
{ {
var data = JsonSerializer.Deserialize<List<User>>(System.IO.File.ReadAllText("Data/users.json"), _jsonSerializerOptions); var data = JsonSerializer.Deserialize<List<User>>(System.IO.File.ReadAllText("Data/users.json"), _jsonSerializerOptions);
@ -46,6 +46,11 @@ namespace Minecraft.Crafting.Api.Controllers
// Simulate the Id // Simulate the Id
item.Id = data.Max(s => s.Id) + 1; item.Id = data.Max(s => s.Id) + 1;
if(item.ImageBase64 == "string")
item.ImageBase64 = null;
if (item.Roles.FirstOrDefault() == "string")
item.Roles.Add("Student");
data.Add(item); data.Add(item);

File diff suppressed because one or more lines are too long

@ -0,0 +1,35 @@
using adminBlazor.Models;
namespace adminBlazor.Factories;
public class TranslationFactory
{
public static Translation Create(TranslationModel model)
{
return new Translation
{
Id = model.Id,
FirstWord = model.FirstWord,
SecondWord = model.SecondWord
};
}
public static TranslationModel ToModel(Translation translation)
{
return new TranslationModel
{
Id = translation.Id,
FirstWord = translation.FirstWord,
SecondWord = translation.SecondWord
};
}
public static void Update(Translation item, TranslationModel model)
{
if (!string.IsNullOrEmpty(model.FirstWord))
item.FirstWord = model.FirstWord;
if (!string.IsNullOrEmpty(model.SecondWord))
item.SecondWord = model.SecondWord;
}
}

@ -9,34 +9,73 @@ namespace adminBlazor.Factories
{ {
public static class VocListFactory public static class VocListFactory
{ {
public static VocabularyListModel ToModel(VocabularyList voc) public static VocabularyListModel ToModel(VocabularyList voc, byte[] imageContent)
{ {
return new VocabularyListModel VocabularyListModel model = new VocabularyListModel
{ {
Id = voc.Id, Id = voc.Id,
Name = voc.Name, Name = voc.Name,
Image = voc.Image, Image = voc.Image,
Aut = voc.Aut Aut = voc.Aut,
ImageBase64 = string.IsNullOrWhiteSpace(voc.ImageBase64) ? Convert.ToBase64String(imageContent) : voc.ImageBase64
}; };
model.Translations = new List<TranslationModel>();
foreach (var item in voc.Translations)
{
model.Translations.Add(new TranslationModel
{
Id = item.Id,
FirstWord = item.FirstWord,
SecondWord = item.SecondWord
});
}
return model;
} }
public static VocabularyList Create(VocabularyListModel voc) public static VocabularyList Create(VocabularyListModel voc)
{ {
return new VocabularyList VocabularyList model = new VocabularyList
{ {
Id = voc.Id, Id = voc.Id,
Name = voc.Name, Name = voc.Name,
Image = voc.Image, Image = voc.Image,
Aut = voc.Aut Aut = voc.Aut,
ImageBase64 = voc.Image != null ? Convert.ToBase64String(voc.Image) : null
}; };
model.Translations = new List<Translation>();
foreach (var item in voc.Translations)
{
model.Translations.Add(new Translation
{
Id = item.Id,
FirstWord = item.FirstWord,
SecondWord = item.SecondWord
});
}
return model;
} }
public static void Update(VocabularyList item, VocabularyListModel voc) public static void Update(VocabularyList item, VocabularyListModel voc)
{ {
if (!string.IsNullOrEmpty(voc.Name)) if (!string.IsNullOrEmpty(voc.Name))
item.Name = voc.Name; item.Name = voc.Name;
if (!string.IsNullOrEmpty(voc.Image)) if (voc.ImageBase64 != null && voc.Image != null)
item.Image = voc.Image; item.ImageBase64 = Convert.ToBase64String(voc.Image);
if (voc.Aut != null)
item.Aut = voc.Aut;
if (voc.Translations == null) return;
item.Translations = new List<Translation>();
foreach (var translation in voc.Translations)
{
item.Translations.Add(new Translation
{
Id = translation.Id,
FirstWord = translation.FirstWord,
SecondWord = translation.SecondWord
});
}
} }
} }

@ -3,10 +3,9 @@ namespace adminBlazor.Models
{ {
public class Translation public class Translation
{ {
private int id; public int Id { get; set; }
private string word1; public string FirstWord { get; set; }
private string word2; public string SecondWord { get; set; }
private int listVoc;
} }
} }

@ -0,0 +1,15 @@
using System;
using System.ComponentModel.DataAnnotations;
namespace adminBlazor.Models
{
public class TranslationModel
{
public int Id { get; set; }
[Required]
public string FirstWord { get; set; }
[Required]
public string SecondWord { get; set; }
}
}

@ -5,8 +5,11 @@ namespace adminBlazor.Models
{ {
public int Id { get; set; } public int Id { get; set; }
public string Name { get; set; } public string Name { get; set; }
public string Image { get; set; } public byte[] Image { get; set; }
public int? Aut { get; set; } public int? Aut { get; set; }
}
public string? ImageBase64 { get; set; }
public List<Translation>? Translations { get; set; }
}
} }

@ -8,11 +8,16 @@ namespace adminBlazor.Models
[Required] [Required]
public int Id { get; set; } public int Id { get; set; }
[Required]
[StringLength(50, ErrorMessage = "Name length can't be more than 50.")]
public string Name { get; set; } public string Name { get; set; }
public string Image { get; set; } public byte[] Image { get; set; }
public int? Aut { get; set; } public int? Aut { get; set; }
public string ImageBase64 { get; set; }
public List<TranslationModel>? Translations { get; set; }
} }
} }

@ -1,5 +1,6 @@
@page "/add" @page "/addUser"
@attribute [Authorize(Roles = "admin")] @attribute [Authorize(Roles = "admin")]
@using adminBlazor.Models
<h3>Add</h3> <h3>Add</h3>
<EditForm Model="@user" OnValidSubmit="@HandleValidSubmit"> <EditForm Model="@user" OnValidSubmit="@HandleValidSubmit">

@ -7,7 +7,7 @@ using adminBlazor.Services;
namespace adminBlazor.Pages namespace adminBlazor.Pages
{ {
public partial class Add public partial class AddUser
{ {
[Inject] [Inject]
public NavigationManager NavigationManager { get; set; } public NavigationManager NavigationManager { get; set; }
@ -26,7 +26,7 @@ namespace adminBlazor.Pages
/// <summary> /// <summary>
/// The current user model /// The current user model
/// </summary> /// </summary>
private Models.UserModel user = new Models.UserModel() private UserModel user = new UserModel()
{ {
Roles = new List<string>() Roles = new List<string>()
}; };

@ -0,0 +1,44 @@
@page "/addVoc"
@attribute [Authorize(Roles = "teacher")]
@using adminBlazor.Models
@using Blazorise.Extensions
<h3>Add Vocabulary List</h3>
<EditForm Model="@voc" OnValidSubmit="@HandleValidSubmit">
<DataAnnotationsValidator />
<ValidationSummary />
<p>
<label for="name">
Name:
<InputText id="name" @bind-Value="voc.Name" />
<ValidationMessage For="@(() => voc.Name)"/>
</label>
</p>
<h4>Words:</h4>
@if (voc.Translations.IsNullOrEmpty() == false)
{
foreach (var word in voc.Translations)
{
{
<div class="word-container">
<label>
First Word:
<InputText @bind-Value="word.FirstWord"/>
</label>
<label>
Second Word:
<InputText @bind-Value="word.SecondWord"/>
</label>
</div>
<button type="button" @onclick="() => RemoveWord(word)">Remove Word</button>
}
}
}
else
{
<p>No words</p>
}
<button type="button" @onclick="AddWord">Add Word</button>
<button type="submit">Submit</button>
</EditForm>

@ -0,0 +1,40 @@
using Blazored.LocalStorage;
using Microsoft.AspNetCore.Components.Forms;
using Microsoft.AspNetCore.Components;
using adminBlazor.Models;
using Microsoft.AspNetCore.Mvc.RazorPages;
using adminBlazor.Services;
namespace adminBlazor.Pages
{
public partial class AddVoc
{
[Inject] public NavigationManager NavigationManager { get; set; }
[Inject] public IVocListService VocService { get; set; }
private VocabularyListModel voc = new VocabularyListModel();
private async void HandleValidSubmit()
{
voc.Translations ??= new List<TranslationModel>();
await VocService.Add(voc);
NavigationManager.NavigateTo("voc");
}
private void AddWord()
{
if (voc.Translations == null)
{
voc.Translations = new List<TranslationModel>();
}
voc.Translations.Add(new TranslationModel());
}
private void RemoveWord(TranslationModel word)
{
voc.Translations.Remove(word);
}
}
}

@ -54,10 +54,9 @@ namespace adminBlazor.Pages
{ {
var item = await DataService.GetById(Id); var item = await DataService.GetById(Id);
var fileContent = await File.ReadAllBytesAsync($"{WebHostEnvironment.WebRootPath}/images/default.jpeg"); var fileContent = await File.ReadAllBytesAsync($"{WebHostEnvironment.WebRootPath}/images/default.jpeg");
// Set the model with the item // Set the model with the item
user = UserFactory.ToModel(item,fileContent); user = UserFactory.ToModel(item,fileContent);
} }

@ -1,29 +1,55 @@
@page "/editVoc/{Id:int}" @page "/editVoc/{Id:int}"
@attribute [Authorize(Roles = "teacher")] @attribute [Authorize(Roles = "teacher")]
@using adminBlazor.Models @using adminBlazor.Models
@using Blazorise.Extensions
<h3>Edit</h3> <h3>Edit</h3>
<h4>Voc id : @Id</h4> <h4>Voc id : @Id</h4>
<EditForm Model="@voc" OnValidSubmit="@HandleValidSubmit"> @if (voc != null)
<DataAnnotationsValidator /> {
<ValidationSummary /> <EditForm Model="@voc" OnValidSubmit="@HandleValidSubmit">
<DataAnnotationsValidator />
<ValidationSummary />
<p> <p>
<label for="name"> <label for="name">
Name: Name:
<InputText id="name" @bind-Value="voc.Name" /> <InputText id="name" @bind-Value="voc.Name" />
<ValidationMessage For="@(() => voc.Name)" /> <ValidationMessage For="@(() => voc.Name)" />
</label> </label>
</p>
<p> </p>
<label for="image">
Image:
<InputText id="image" @bind-Value="voc.Image" />
<ValidationMessage For="@(() => voc.Image)" />
</label>
</p>
<button type="submit">Submit</button> <h4>Words:</h4>
</EditForm> @if (voc.Translations.IsNullOrEmpty() == false)
{
foreach (var word in voc.Translations)
{
{
<div class="word-container">
<label>
First Word:
<InputText @bind-Value="word.FirstWord"/>
</label>
<label>
Second Word:
<InputText @bind-Value="word.SecondWord"/>
</label>
</div>
<button type="button" @onclick="() => RemoveWord(word)">Remove Word</button>
}
}
}
else
{
<p>No words</p>
}
<button type="button" @onclick="AddWord">Add Word</button>
<button type="submit">Submit</button>
</EditForm>
}
else
{
<p>Loading...</p>
}

@ -3,7 +3,11 @@ using adminBlazor.Models;
using adminBlazor.Services; using adminBlazor.Services;
using Blazored.LocalStorage; using Blazored.LocalStorage;
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Forms;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
namespace adminBlazor.Pages namespace adminBlazor.Pages
@ -22,23 +26,46 @@ namespace adminBlazor.Pages
[Inject] [Inject]
public IWebHostEnvironment WebHostEnvironment { get; set; } public IWebHostEnvironment WebHostEnvironment { get; set; }
public VocabularyList currVoc;
private VocabularyListModel voc = new VocabularyListModel(); private VocabularyListModel voc = new VocabularyListModel();
private async void HandleValidSubmit() private async void HandleValidSubmit()
{ {
await VocListService.Update(Id, voc); await VocListService.Update(Id, voc);
NavigationManager.NavigateTo("list"); NavigationManager.NavigateTo("voc");
}
private async Task LoadImage(InputFileChangeEventArgs e)
{
// Set the content of the image to the model
using (var memoryStream = new MemoryStream())
{
await e.File.OpenReadStream().CopyToAsync(memoryStream);
voc.Image = memoryStream.ToArray();
}
}
private void AddWord()
{
if (voc.Translations == null)
{
voc.Translations = new List<TranslationModel>();
}
voc.Translations.Add(new TranslationModel());
} }
private void RemoveWord(TranslationModel word)
{
voc.Translations.Remove(word);
}
protected async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
var item = await VocListService.GetById(Id); var item = await VocListService.GetById(Id);
voc = VocListFactory.ToModel(item); var fileContent = await File.ReadAllBytesAsync($"{WebHostEnvironment.WebRootPath}/images/default.jpeg");
voc = VocListFactory.ToModel(item,fileContent);
} }
} }
} }

@ -11,9 +11,7 @@
<h3>List</h3> <h3>List</h3>
<div> <div>
<NavLink class="btn btn-primary" href="Add" Match="NavLinkMatch.All"> <a href="addUser" class="btn btn-primary" > <i class="fa fa-plus"></i> Ajouter </a>
<i class="fa fa-plus"></i> Ajouter
</NavLink>
</div> </div>
<DataGrid TItem="User" <DataGrid TItem="User"

@ -10,6 +10,10 @@
<link href="_content/Blazorise.Bootstrap/blazorise.bootstrap.css" rel="stylesheet" /> <link href="_content/Blazorise.Bootstrap/blazorise.bootstrap.css" rel="stylesheet" />
<h3>Vocabulary Lists</h3> <h3>Vocabulary Lists</h3>
<div>
<a href="addVoc" class="btn btn-primary" > <i class="fa fa-plus"></i> Ajouter </a>
</div>
<DataGrid TItem="VocabularyList" <DataGrid TItem="VocabularyList"
Data="@_vocList" Data="@_vocList"
ReadData="@OnReadData" ReadData="@OnReadData"
@ -18,9 +22,20 @@
ShowPager ShowPager
Responsive> Responsive>
<DataGridColumn TItem="VocabularyList" Field="@nameof(VocabularyList.Id)" Caption="Image">
<DisplayTemplate>
@if (!string.IsNullOrWhiteSpace(context.ImageBase64))
{
<img src="@($"data:image/png;base64, {context.ImageBase64}")" class="img-thumbnail" style="min-width: 50px; max-width: 150px" />
}
else
{
<img src="images/words.jpg" class="img-thumbnail" style="max-width: 150px" />
}
</DisplayTemplate>
</DataGridColumn>
<DataGridColumn TItem="VocabularyList" Field="@nameof(VocabularyList.Id)" Caption="id" /> <DataGridColumn TItem="VocabularyList" Field="@nameof(VocabularyList.Id)" Caption="id" />
<DataGridColumn TItem="VocabularyList" Field="@nameof(VocabularyList.Name)" Caption="Name" /> <DataGridColumn TItem="VocabularyList" Field="@nameof(VocabularyList.Name)" Caption="Name" />
<DataGridColumn TItem="VocabularyList" Field="@nameof(VocabularyList.Image)" Caption="Image" />
<DataGridColumn TItem="VocabularyList" Field="@nameof(VocabularyList.Aut)" Caption="Author ID"> <DataGridColumn TItem="VocabularyList" Field="@nameof(VocabularyList.Aut)" Caption="Author ID">
<DisplayTemplate> <DisplayTemplate>
@if (context is VocabularyList voc) @if (context is VocabularyList voc)

@ -1,5 +1,6 @@
@page "/" @page "/"
@using Microsoft.AspNetCore.Components.Web @using Microsoft.AspNetCore.Components.Web
@using Microsoft.AspNetCore.Mvc.TagHelpers
@namespace adminBlazor.Pages @namespace adminBlazor.Pages
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

@ -25,7 +25,6 @@ builder.Services.AddBlazoredModal();
builder.Services.AddRazorPages(); builder.Services.AddRazorPages();
builder.Services.AddServerSideBlazor(); builder.Services.AddServerSideBlazor();
builder.Services.AddScoped<IDataService, DataLocalService>(); builder.Services.AddScoped<IDataService, DataLocalService>();
builder.Services.AddScoped<IDataService, DataApiService>();
builder.Services.AddScoped<IVocListService, VocListLocalService>(); builder.Services.AddScoped<IVocListService, VocListLocalService>();

@ -1,14 +1,5 @@
{ {
"profiles": { "profiles": {
"http": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:5138",
"dotnetRunMessages": true
},
"https": { "https": {
"commandName": "Project", "commandName": "Project",
"launchBrowser": true, "launchBrowser": true,

@ -20,8 +20,8 @@
{ {
CurrentUser = new List<AppUser> CurrentUser = new List<AppUser>
{ {
new AppUser { UserName = "Admin", Password = "123456", Roles = new List<string> { "admin" } }, new AppUser { UserName = "Admin", Password = "1", Roles = new List<string> { "admin" } },
new AppUser{ UserName ="Teacher1", Password = "123456", Roles = new List<string>{ "teacher" } } new AppUser{ UserName = "Teacher", Password = "1", Roles = new List<string>{ "teacher" } }
}; };
} }

@ -1,6 +1,7 @@
using adminBlazor.Components; using adminBlazor.Components;
using adminBlazor.Factories; using adminBlazor.Factories;
using adminBlazor.Models; using adminBlazor.Models;
using Microsoft.AspNetCore.Http.HttpResults;
using System.Reflection.Metadata.Ecma335; using System.Reflection.Metadata.Ecma335;
namespace adminBlazor.Services namespace adminBlazor.Services
@ -24,24 +25,24 @@ namespace adminBlazor.Services
var item = UserFactory.Create(model); var item = UserFactory.Create(model);
// Save the data // Save the data
await _http.PostAsJsonAsync("https://localhost:7234/api/User/", item); await _http.PostAsJsonAsync("http://host.docker.internal:7234/api/User/add", item);
} }
public async Task<int> Count() public async Task<int> Count()
{ {
return await _http.GetFromJsonAsync<int>("https://localhost:7234/api/User/count"); return await _http.GetFromJsonAsync<int>("http://host.docker.internal:7234/api/User/count");
} }
public async Task<List<User>> List(int currentPage, int pageSize) public async Task<List<User>> List(int currentPage, int pageSize)
{ {
_logger.LogInformation("User API : call of method LIST."); _logger.LogInformation("User API : call of method LIST.");
return await _http.GetFromJsonAsync<List<User>>($"https://localhost:7234/api/User/?currentPage={currentPage}&pageSize={pageSize}"); return await _http.GetFromJsonAsync<List<User>>($"http://host.docker.internal:7234/api/User/?currentPage={currentPage}&pageSize={pageSize}");
} }
public async Task<User> GetById(int id) public async Task<User> GetById(int id)
{ {
_logger.LogInformation("User API : call of method GetByID."); _logger.LogInformation("User API : call of method GetByID.");
return await _http.GetFromJsonAsync<User>($"https://localhost:7234/api/User/{id}"); return await _http.GetFromJsonAsync<User>($"http://host.docker.internal:7234/api/User/{id}");
} }
public async Task Update(int id, UserModel model) public async Task Update(int id, UserModel model)
@ -51,18 +52,18 @@ namespace adminBlazor.Services
_logger.LogInformation("User API : call of method UPDATE on User ID : {Id}.", id); _logger.LogInformation("User API : call of method UPDATE on User ID : {Id}.", id);
await _http.PutAsJsonAsync($"https://localhost:7234/api/User/{id}", item); await _http.PutAsJsonAsync($"http://host.docker.internal:7234/api/User/{id}", item);
} }
public async Task Delete(int id) public async Task Delete(int id)
{ {
_logger.LogInformation("User API : call of method DELETE on User ID : {Id}.", id); _logger.LogInformation("User API : call of method DELETE on User ID : {Id}.", id);
await _http.DeleteAsync($"https://localhost:7234/api/User/{id}"); await _http.DeleteAsync($"http://host.docker.internal:7234/api/User/{id}");
} }
public async Task<List<CraftingRecipe>> GetRecipes() public async Task<List<CraftingRecipe>> GetRecipes()
{ {
return await _http.GetFromJsonAsync<List<CraftingRecipe>>("https://localhost:7234/api/User/recipe"); return await _http.GetFromJsonAsync<List<CraftingRecipe>>("http://host.docker.internal:7234/api/User/recipe");
} }
} }
} }

@ -62,6 +62,7 @@ namespace adminBlazor.Services
{ {
// this code add in the local storage the fake data // this code add in the local storage the fake data
var originalData = await _http.GetFromJsonAsync<VocabularyList[]>($"{_navigationManager.BaseUri}voc.json"); var originalData = await _http.GetFromJsonAsync<VocabularyList[]>($"{_navigationManager.BaseUri}voc.json");
await _localStorage.SetItemAsync("voc", originalData); await _localStorage.SetItemAsync("voc", originalData);
} }

@ -1,4 +1,5 @@
{ {
"https_port": 443,
"Creators": { "Creators": {
"Name": [ "Name": [
"Patrick Brugière", "Patrick Brugière",
@ -10,7 +11,8 @@
"Logging": { "Logging": {
"LogLevel": { "LogLevel": {
"Default": "Error", "Default": "Error",
"Microsoft": "Warning" "Microsoft.AspNetCore": "Warning",
"Microsoft.AspNetCore.DataProtection": "None"
}, },
"Debug": { "Debug": {
"LogLevel": { "LogLevel": {

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB

@ -2,13 +2,27 @@
{ {
"id": 1, "id": 1,
"name": "Entreprise", "name": "Entreprise",
"image": "link", "image": null,
"aut": null "aut": null,
"translations" : [{
"id": 1,
"firstWord" : "pain",
"secondWord" : "bread"
},
{"id": 1,
"firstWord" : "vin",
"secondWord" : "wine"
}]
}, },
{ {
"id": 2, "id": 2,
"name": "Animaux", "name": "Animaux",
"image": "link", "image": null,
"aut" : 1 "aut" : 1,
"translations": [{
"id": 1,
"firstWord" : "baguette",
"secondWord" : "pain"
}]
} }
] ]
Loading…
Cancel
Save