Merge branch 'master' of https://codefirst.iut.uca.fr/git/vianney.jourdy/MapManga into Matheo
commit
8c92dfb826
@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="MangaMap.Views.modifyOeuvre"
|
||||
Title="modifyOeuvre">
|
||||
<VerticalStackLayout>
|
||||
|
||||
<Label Text="Modification d'une série" FontSize="Title" Margin="0,0,0,20" TextColor="#ffffff" HorizontalOptions="Center"/>
|
||||
|
||||
<Grid ColumnDefinitions="*,*" Margin="10" ColumnSpacing="10">
|
||||
<Entry x:Name="nameEntry" Placeholder="Nom" Margin="0,0,0,10" Style="{StaticResource Champs}"/>
|
||||
|
||||
<Entry Grid.Column="1" x:Name="typeEntry" Placeholder="Type" Margin="0,0,0,10" Style="{StaticResource Champs}"/>
|
||||
</Grid>
|
||||
|
||||
<Entry x:Name="descriptionEntry" Placeholder="Description" Margin="0,0,0,10" Style="{StaticResource Champs}"/>
|
||||
|
||||
<Entry x:Name="nbEpisodeEntry" Placeholder="Nombre d'épisodes" Margin="0,0,0,10" Style="{StaticResource Champs}"/>
|
||||
|
||||
<Button Text="Modifier série" Style="{StaticResource Bouton}" Clicked="AddClicked"/>
|
||||
|
||||
</VerticalStackLayout>
|
||||
</ContentPage>
|
@ -0,0 +1,54 @@
|
||||
using Models;
|
||||
|
||||
namespace MangaMap.Views;
|
||||
|
||||
public partial class modifyOeuvre : ContentPage
|
||||
{
|
||||
public Manager my_manager => (App.Current as App).MyManager;
|
||||
public Oeuvre oeuvreModifie { get; set; }
|
||||
|
||||
public modifyOeuvre(Oeuvre anime)
|
||||
{
|
||||
oeuvreModifie = anime;
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
BindingContext = oeuvreModifie;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gère l'événement de clic sur le bouton de modification d'une oeuvre.
|
||||
/// </summary>
|
||||
/// <param name="sender">L'objet déclencheur de l'événement.</param>
|
||||
/// <param name="e">Les arguments de l'événement.</param>
|
||||
private async void AddClicked(object sender, System.EventArgs e)
|
||||
{
|
||||
// Récupérer les valeurs des entrées
|
||||
string nom = nameEntry.Text;
|
||||
string type = typeEntry.Text;
|
||||
int nbEp = Convert.ToInt32(nbEpisodeEntry.Text);
|
||||
string description = descriptionEntry.Text;
|
||||
|
||||
if (nbEp < 0)
|
||||
{
|
||||
await DisplayAlert("Erreur", "Il faut avoir au moins 1 épisode pour l'application.", "OK");
|
||||
return;
|
||||
}
|
||||
|
||||
if (nom != null)
|
||||
oeuvreModifie.Nom = nom;
|
||||
|
||||
if (type != null)
|
||||
oeuvreModifie.Type = type;
|
||||
|
||||
if (description != null)
|
||||
oeuvreModifie.Description = description;
|
||||
|
||||
if (nbEp > 0)
|
||||
oeuvreModifie.NbEpisodes = nbEp;
|
||||
|
||||
my_manager.sauvegarder();
|
||||
await Navigation.PushAsync(new homePage());
|
||||
return;
|
||||
}
|
||||
}
|
Loading…
Reference in new issue