Example #1
0
        public async Task <IActionResult> Update([FromRoute] int id, [FromBody] TourList tourList)
        {
            _context.Update(tourList);

            await _context.SaveChangesAsync();

            return(Ok(tourList));
        }
Example #2
0
        public async Task <IActionResult> Create([FromBody] TourList tourList)
        {
            await _context.TourLists.AddAsync(tourList);

            await _context.SaveChangesAsync();

            return(Ok(tourList));
        }
Example #3
0
        public async Task <int> Handle(CreateTourListCommand request, CancellationToken cancellationToken)
        {
            var entity = new TourList {
                City = request.City
            };

            _context.TourLists.Add(entity);
            await _context.SaveChangesAsync(cancellationToken);

            return(entity.Id);
        }
Example #4
0
        public void AddNewTour()
        {
            if (SelectedTour != null && SelectedTour.ID == -1)
            {
                return;
            }
            var newTour = new Tour {
                DepartureDateTime = DateTime.Now.AddDays(1)
            };

            TourList.Add(newTour);
            SelectedTour    = TourList[TourList.Count - 1];
            SelectedTour.ID = -1;
        }
        private void navTournamentList_Click(object sender, EventArgs e)
        {
            TourList curForm = new TourList();

            mdiStatusMsg.Text = curForm.Name + " opening";

            // Check for open instance of selected form
            for (int idx = 0; idx < this.MdiChildren.Length; idx++)
            {
                if (((Form)this.MdiChildren[idx]).Name == curForm.Name)
                {
                    ((Form)this.MdiChildren[idx]).Activate();
                    return;
                }
            }

            // Set the Parent Form and display requested form
            curForm.MdiParent = this;
            curForm.Show();
            mdiStatusMsg.Text = curForm.Name + " open";
        }
Example #6
0
        public void DeleteSelectedTour()
        {
            if (SelectedTour == null)
            {
                return;
            }
            if (SelectedTour.ID == -1)
            {
                TourList.RemoveAt(TourList.Count - 1);
            }
            else
            {
                WynneDatabase db     = Database.Instance;
                bool          result = db.DeleteTour(SelectedTour.ID);
                if (result == false)
                {
                    throw new Exception("Error: Could not delete tour!");
                }
            }

            SelectedTour = null;
            UpdateTourList();
        }