fix : confirm conflict

pull/38/head
Maxence GUITARD 1 year ago
commit 6156f89dfc

@ -25,9 +25,12 @@ namespace Blazor.Pages.Admins
[Inject] [Inject]
public ILogger<EditAdministrator> Logger { get; set; } public ILogger<EditAdministrator> Logger { get; set; }
private string OldAdminName { get; set; }
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
var administrator = await DataService.GetAdminById(Id); var administrator = await DataService.GetAdminById(Id);
OldAdminName = administrator.Username;
// Set the model with the admin // Set the model with the admin
administratorModel = new AdministratorModel administratorModel = new AdministratorModel
@ -66,7 +69,7 @@ namespace Blazor.Pages.Admins
} }
Logger.LogInformation("Chapter '{administratorModelUserame}' edited", administratorModel.Username); Logger.LogInformation("Admin '{OldAdminModelName}' edited in '{NewAdminModelName}'",OldAdminName,administratorsModel.Username);
NavigationManager.NavigateTo("administrators"); NavigationManager.NavigateTo("administrators");
} }

@ -23,12 +23,12 @@ public partial class EditChapter
[Inject] [Inject]
public ILogger<EditChapter> Logger { get; set; } public ILogger<EditChapter> Logger { get; set; }
private string oldChapterName { get; set; } private string OldChapterName { get; set; }
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
var chapter = await DataService.GetById(Id); var chapter = await DataService.GetById(Id);
oldChapterName = chapter.Name; OldChapterName = chapter.Name;
// Set the model with the chapter // Set the model with the chapter
chapterModel = new ChapterModel chapterModel = new ChapterModel
@ -55,8 +55,6 @@ public partial class EditChapter
var response = await httpClient.PostAsync(apiUri, formContent); var response = await httpClient.PostAsync(apiUri, formContent);
Logger.LogInformation("Chapter '{OldChapterModelName}' edited in '{NewChapterModelName}'",oldChapterName,chapterModel.Name);
if (response.IsSuccessStatusCode) if (response.IsSuccessStatusCode)
{ {
var responseBody = await response.Content.ReadAsStringAsync(); var responseBody = await response.Content.ReadAsStringAsync();
@ -66,6 +64,8 @@ public partial class EditChapter
var errorResponse = await response.Content.ReadAsStringAsync(); var errorResponse = await response.Content.ReadAsStringAsync();
} }
} }
Logger.LogInformation("Chapter '{OldChapterModelName}' edited in '{NewChapterModelName}'", OldChapterName, chapterModel.Name);
NavigationManager.NavigateTo("chapters"); NavigationManager.NavigateTo("chapters");
} }
} }

Loading…
Cancel
Save