示例#1
0
        private void SaveManager()
        {
            Manager manager = null;

            if (!Managers.Exists(m => m.Id == ManagerViewModel.Id))
            {
                try
                {
                    manager = new Manager()
                    {
                        Name        = ManagerViewModel.Name,
                        Nationality = new Nation()
                        {
                            Name = ManagerViewModel.Nationality.Name
                        },
                        Age = ManagerViewModel.Age.Value,
                    };
                    App.Managers.Add(manager);

                    manager.Id = SquadRepository.AddManager(manager);
                }
                catch (Exception e)
                {
                    // TODO: validations
                }
            }

            manager = App.Managers.Find(m => m.Id == ManagerViewModel.Id);
            Browser.Browse(new TeamDetailsArgs(BrowseArgsType.TeamDetailsArgs, manager));
        }