Exemplo n.º 1
0
        public void RegisterATeamThatAlreadyExisistTest()
        {
            var provider = new TeamProvider();
            var team     = provider.RegisterTeam("RegisterATeamTest");

            var fetchTeam = provider.GetTeamById(team.Id);

            Assert.AreEqual(fetchTeam.TeamName, team.TeamName);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Gets the name of the team by team.
        /// </summary>
        /// <param name="teamName">Name of the team.</param>
        /// <returns></returns>
        public ResponseItem <Team> GetTeamByTeamName(string teamName)
        {
            var provider = new TeamProvider();
            var team     = provider.GetTeamByTeamName(teamName);

            return(new ResponseItem <Team>(ResultCodeEnum.Success)
            {
                Data = team
            });
        }
Exemplo n.º 3
0
        public ResponseItem <Contracts.Api.Team> Post(Contracts.Api.Team resource)
        {
            var provider = new TeamProvider();

            var team = provider.RegisterTeam(resource.TeamName);

            return(new ResponseItem <Contracts.Api.Team>(ResultCodeEnum.Success)
            {
                Data = team.Map()
            });
        }
Exemplo n.º 4
0
        public ResponseList <Contracts.Api.Team> Get(string teamName = null)
        {
            var teamProvider = new TeamProvider();
            var team         = teamProvider.GetTeamByTeamName(teamName);

            return(new ResponseList <Contracts.Api.Team>(ResultCodeEnum.Success)
            {
                Data = new List <Contracts.Api.Team> {
                    team.Map()
                }
            });
        }
Exemplo n.º 5
0
        public ResponseItem <Contracts.Api.Team> Get(Guid id)
        {
            if (id == null)
            {
                throw new BadRequestException();
            }

            var provider = new TeamProvider();
            var team     = provider.GetTeamById(id);

            return(new ResponseItem <Contracts.Api.Team>(ResultCodeEnum.Success)
            {
                Data = team.Map()
            });
        }
Exemplo n.º 6
0
        /// <summary>
        /// Registers the team.
        /// </summary>
        /// <param name="teamName">Name of the team.</param>
        /// <returns></returns>
        public ResponseItem <Team> RegisterTeam(string teamName)
        {
            var provider     = new TeamProvider();
            var existingTeam = provider.GetTeamByTeamName(teamName);

            if (existingTeam != null)
            {
                return(new ResponseItem <Team>(ResultCodeEnum.GeneralFailure)
                {
                    IsSuccessfull = false,
                    Errors = new string[] { "Team already exists. Cannot register a duplicate name." }
                });
            }

            var team = provider.RegisterTeam(teamName);

            return(new ResponseItem <Team>(ResultCodeEnum.Success)
            {
                Data = team
            });
        }
Exemplo n.º 7
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            //            SetMainWindow(new LoginWindowControl());

            MatchSelectionWindow window = new MatchSelectionWindow();

            IVirtualListProvider <Team> customerProvider = new TeamProvider();

            customerProvider.CreateMainList();

            MatchSelectionWindowModel <Team> model = new MatchSelectionWindowModel <Team>
            {
                AutoComboSource = new AsyncVirtualizingCollection <Team>(customerProvider, 100, 300 * 1000)
            };

            window.DataContext = model;

            SetMainWindow(window);
        }