protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            infomoment = e.Parameter as Infomoment;

            titel.Text        = infomoment.Titel;
            beschrijving.Text = infomoment.Beschrijving;
            datum.Text        = infomoment.Datum;
            tijd.Text         = infomoment.Uur;
            List <Opleiding> opleidingen = await Api.GetAsync <List <Opleiding> >();

            List <Campus> campussen = await Api.GetAsync <List <Campus> >();

            foreach (Opleiding o in opleidingen)
            {
                if (o == infomoment.Opleiding)
                {
                    opleiding.Text = o.Naam;
                }
            }
            foreach (Campus c in campussen)
            {
                if (c == infomoment.Campus)
                {
                    campus.Text = c.Naam;
                }
            }
        }
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     infomoment        = e.Parameter as Infomoment;
     titel.Text        = infomoment.Titel;
     beschrijving.Text = infomoment.Beschrijving;
     Datum.Date        = DateTime.Parse(infomoment.Datum);
     Tijd.Time         = TimeSpan.Parse(infomoment.Uur);
 }
        public async Task <IHttpActionResult> GetInfomoment(int id)
        {
            Infomoment infomoment = await db.Infomoments.FindAsync(id);

            if (infomoment == null)
            {
                return(NotFound());
            }

            return(Ok(infomoment));
        }
        public async Task <IHttpActionResult> DeleteInfomoment(int id)
        {
            Infomoment infomoment = await db.Infomoments.FindAsync(id);

            if (infomoment == null)
            {
                return(NotFound());
            }

            db.Infomoments.Remove(infomoment);
            await db.SaveChangesAsync();

            return(Ok(infomoment));
        }
        private async void Save_Click(object sender, RoutedEventArgs e)
        {
            Infomoment infomoment = new Infomoment();

            infomoment.Titel        = titel.Text;
            infomoment.Beschrijving = beschrijving.Text;
            infomoment.Datum        = Datum.Date.ToString().Split(' ')[0];
            infomoment.Uur          = Tijd.Time.ToString();

            var campus    = CampussenComboBox.SelectedValue as Campus;
            var opleiding = OpleidingenComboBox.SelectedValue as Opleiding;

            infomoment.Campus    = campus is NullCampus ? null : campus;
            infomoment.Opleiding = opleiding is NullOpleiding ? null : opleiding;

            await Api.PostAsync <Infomoment>(infomoment);

            Frame.GoBack();
        }
        public async Task <IHttpActionResult> PutInfomoment(int id, Infomoment infomoment)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != infomoment.InfomomentId)
            {
                return(BadRequest());
            }

            db.Entry(infomoment).State = EntityState.Modified;

            if (infomoment.Campus != null)
            {
                db.Entry(infomoment.Campus).State = EntityState.Unchanged;
            }

            if (infomoment.Opleiding != null)
            {
                db.Entry(infomoment.Opleiding).State = EntityState.Unchanged;
            }

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public async Task <IHttpActionResult> PostInfomoment(Infomoment infomoment)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.Infomoments.Add(infomoment);

            if (infomoment.Campus != null)
            {
                db.Entry(infomoment.Campus).State = EntityState.Unchanged;
            }

            if (infomoment.Opleiding != null)
            {
                db.Entry(infomoment.Opleiding).State = EntityState.Unchanged;
            }

            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = infomoment.InfomomentId }, infomoment));
        }
        private void Infomoment_click(object sender, ItemClickEventArgs e)
        {
            Infomoment i = e.ClickedItem as Infomoment;

            Frame.Navigate(typeof(InfomomentfeedDetail), i);
        }
示例#9
0
        private void Infomoment_click(object sender, ItemClickEventArgs e)
        {
            Infomoment infomoment = e.ClickedItem as Infomoment;

            Frame.Navigate(typeof(InfomomentBeheerUpdate), infomoment);
        }