Пример #1
0
        public IActionResult Create(int ID)
        {
            TCViewModel model = new TCViewModel();

            model.current = _context.leagues.SingleOrDefault(l => l.Id == ID);
            return(View(model));
        }
Пример #2
0
 private void btnSave_Click(object sender, RoutedEventArgs e)
 {
     TCViewModel       = new TCViewModel();
     TCViewModel.Code  = txtCode.Text;
     TCViewModel.Name  = txtName.Text;
     this.DialogResult = true;
 }
        private TCViewModel getTC(Configs.LayerViewModel model)
        {
            TCViewModel ok = null;

            foreach (var tc in TCList)
            {
                foreach (var layer in tc.LayerList)
                {
                    if (layer.Code == model.Code)
                    {
                        ok = tc;
                    }
                }
            }
            return(ok);
        }
        private void AddLayer(TCViewModel tc)
        {
            if (tc == null)
            {
                return;
            }

            var window = new LayerConfigWindow();
            var dialog = window.ShowDialog();

            if (dialog.GetValueOrDefault())
            {
                var max = window.MaxLayer.ToInt32();
                if (max > 0)
                {
                    if (window.IsAllTC)
                    {
                        foreach (var item in TCList)
                        {
                            item.LayerList.Clear();
                            for (int i = 1; i <= max; i++)
                            {
                                item.LayerList.Add(new Configs.LayerViewModel {
                                    Code = "" + i, Name = "L" + i
                                });
                            }
                        }
                    }
                    else
                    {
                        for (int i = 1; i <= max; i++)
                        {
                            tc.LayerList.Add(new Configs.LayerViewModel {
                                Code = "" + i, Name = "L" + i
                            });
                        }
                    }
                }
                else
                {
                    tc.LayerList.Add(window.LayerViewModel);
                }
            }
        }
Пример #5
0
        public IActionResult AddTeam(TCViewModel incoming)
        {
            Team next = new Team();

            next.Name      = incoming.TC.Name;
            next.leagueId  = incoming.TC.league;
            next.league    = _context.leagues.SingleOrDefault(l => l.Id == next.leagueId);
            next.userId    = _userManager.GetUserId(User);
            next.user      = _context.Users.SingleOrDefault(u => u.Id == next.userId);
            next.CreatedAt = DateTime.Now;
            next.UpdatedAt = DateTime.Now;
            next.wins      = 0;
            next.losses    = 0;
            next.score     = 0;
            next.athletes  = new List <Athlete>();
            _context.teams.Add(next);
            next.league.UpdatedAt = DateTime.Now;
            _context.SaveChanges();
            next = _context.teams.Last();
            return(RedirectToAction("Display", "Team", new { ID = next.Id }));
        }
Пример #6
0
        private void EditTC(TCViewModel tc)
        {
            var window = new TCParamWindow();

            window.ShowDialog();
        }