Exemple #1
0
        public async Task <IActionResult> PutTypePatrimoine([FromRoute] int id, [FromBody] TypePatrimoine typePatrimoine)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != typePatrimoine.Id)
            {
                return(BadRequest());
            }

            _context.Entry(typePatrimoine).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TypePatrimoineExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public EnregistrementPatrimoineViewModel(INavigation navigation)
        {
            _navigation     = navigation;
            _patrimoine     = new Patrimoine();
            _typePatrimoine = new TypePatrimoine();



            _multiMediaPickerService = DependencyService.Get <IMultiMediaPickerService>();

            EnregistrementCommand = new Command(async() => await EnregistrementDuBien());
            AnnulerCommand        = new Command(async() => await Annuler());


            SelectImagesCommand = new Command(async(obj) =>
            {
                var hasPermission = await CheckPermissionsAsync();
                if (hasPermission)
                {
                    Media = new ObservableCollection <Patrimoine>();
                    await _multiMediaPickerService.PickPhotosAsync();
                }
            });

            _multiMediaPickerService.OnMediaPicked += (s, a) =>
            {
                Device.BeginInvokeOnMainThread(() =>
                {
                    Media.Add(a);
                });
            };

            FetchTypePatrimoine();
        }
        public AjoutTypePatrimoineViewModel(INavigation navigation)
        {
            _navigation     = navigation;
            _typePatrimoine = new TypePatrimoine();
            _AjouterTypePatrimoineValidator = new TypePatrimoineValidator();


            ValiderCommand = new Command(async() => await EnregistrementDuType());
            AnnulerCommand = new Command(async() => await Annuler());
        }
Exemple #4
0
        public async Task <IActionResult> PostTypePatrimoine([FromBody] TypePatrimoine typePatrimoine)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.TypePatrimoines.Add(typePatrimoine);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetTypePatrimoine", new { id = typePatrimoine.Id }, typePatrimoine));
        }
Exemple #5
0
        public DetailsPatrimoineViewModel(INavigation navigation, int selectedPatrimoineID)
        {
            _navigation     = navigation;
            _patrimoine     = new Patrimoine();
            _patrimoine.Id  = selectedPatrimoineID;
            _typePatrimoine = new TypePatrimoine
            {
                IdTypePatrimoine = selectedPatrimoineID
            };

            DeleteCommand = new Command(async() => await DeletePatrimoine());

            MiseAjourPageCommand = new Command(async() => await ModificationDesInfos());

            FetchMembreDetailsAsync();
        }
Exemple #6
0
        public ListFilActualiteViewModel(INavigation navigation)
        {
            _navigation     = navigation;
            _document       = new Document();
            _membre         = new Membre();
            _evenement      = new Evenement();
            _patrimoine     = new Patrimoine();
            _typeMembre     = new TypeMembre();
            _typePatrimoine = new TypePatrimoine();
            _typeDocument   = new TypeDocument();



            AjoutEvenementCommand       = new Command(async() => await AjouterUnEvenement());
            DeleteEvenementCommand      = new Command(async() => await SupprimerUnEvenement());
            AllerAListeEvenementCommand = new Command(async() => await AllerAlaListeDesEvenements());

            AjouterDocumentCommand     = new Command(async() => await AjouterUnDocument());
            SupprimerDocumentCommand   = new Command(async() => await SupprimerUnDocument());
            AllerAListeDocumentCommand = new Command(async() => await AllerAlaListeDesDocuments());

            AjouterMembreCommand     = new Command(async() => await AjouterUnMembre());
            SupprimerMembreCommand   = new Command(async() => await SupprimerUnMembre());
            AllerAListeMembreCommand = new Command(async() => await AllerAlaListeDesMembres());

            AjouterBienCommand           = new Command(async() => await AjouterBien());
            SupprimerPatrimoineCommand   = new Command(async() => await SupprimerPatrimoine());
            AllerAListePatrimoineCommand = new Command(async() => await AllerAListePatrimoine());


            MessagingCenter.Subscribe <App>((App)Application.Current, "ActualiserListe", (sender) =>
            {
                FetchPatrimoine();
                FetchEvenements();
                FetchMembre();
                FetchDocumentsAsync();
            });



            FetchPatrimoine();
            FetchEvenements();
            FetchMembre();
            FetchDocumentsAsync();
        }
        public MiseAjourPatrimoineViewModel(INavigation navigation, int selectedPatrimoineID)
        {
            _navigation     = navigation;
            _patrimoine     = new Patrimoine();
            _patrimoine.Id  = selectedPatrimoineID;
            _typePatrimoine = new TypePatrimoine
            {
                IdTypePatrimoine = selectedPatrimoineID
            };

            DeleteCommand         = new Command(async() => await DeletePatrimoine());
            EnregistrementCommand = new Command(async() => await ModificationDesInfos());
            AnnulerCommand        = new Command(async() => await retourDePage());


            FetchPatrimoineDetails();
            FetchTypePatrimoine();
        }