示例#1
0
        private async Task AddDestination_task()
        {
            if (this.NewDestination.Name == null || this.NewDestination.Name == "")
            {
                Messenger.Default.Send <Dialog>(new Dialog()
                {
                    Message   = "Geen naam ingevuld",
                    Ok        = "Ok",
                    Nok       = null,
                    ViewOk    = null,
                    ViewNok   = null,
                    ParamView = false,
                    Cb        = null
                });
                return;
            }
            if (this.NewCity == null || this.NewCity.ID == null)
            {
                Messenger.Default.Send <Dialog>(new Dialog()
                {
                    Message   = "Geen stad ingevuld",
                    Ok        = "Ok",
                    Nok       = null,
                    ViewOk    = null,
                    ViewNok   = null,
                    ParamView = false,
                    Cb        = null
                });
                return;
            }
            Destination destination = new Destination()
            {
                Cities_ID = this.NewCity.ID,
                Location  = this.NewDestination.Location,
                Name      = this.NewDestination.Name
            };
            Response ok = await DestinationRepository.PostDestination(destination);

            if (ok.Success == true)
            {
                Messenger.Default.Send <Dialog>(new Dialog()
                {
                    Message   = "Bestemming toegevoegd",
                    Ok        = "Ok",
                    Nok       = null,
                    ViewOk    = typeof(Bestemmingen),
                    ViewNok   = null,
                    ParamView = false,
                    Cb        = null
                });
            }
        }