Beispiel #1
0
        /// <summary>
        /// Save a Team to the Database
        /// </summary>
        /// <param name="team">Teamobject to Save</param>
        /// <returns>1 if successfull, otherwise 0</returns>
        public int SaveTeam(FluffTailRanking.BusinessLayer.BusinessObjects.Team team)
        {
            try
            {
                using (KickerEntities context = new KickerEntities())
                {
                    FluffTailRanking.BusinessLayer.Persistence.Team current = new FluffTailRanking.BusinessLayer.Persistence.Team()
                    {
                        teamname  = team.Name,
                        eloid     = team.ELOID,
                        playerone = team.Players[0].ID,
                        playertwo = team.Players[2].ID,
                        id        = team.ID,
                        wins      = team.Wins
                    };
                    context.Team.Add(current);
                    context.SaveChanges();
                }

                return(1);
            }
            catch (Exception ex)
            {
                return(0);
            }
        }
        /// <summary>
        /// Save a Team to the Database
        /// </summary>
        /// <param name="team">Teamobject to Save</param>
        /// <returns>1 if successfull, otherwise 0</returns>
        public int SaveTeam(FluffTailRanking.BusinessLayer.BusinessObjects.Team team)
        {
            try
            {
                using (KickerEntities context = new KickerEntities())
                {
                    FluffTailRanking.BusinessLayer.Persistence.Team current = new FluffTailRanking.BusinessLayer.Persistence.Team()
                    {
                        teamname = team.Name,
                        eloid = team.ELOID,
                        playerone = team.Players[0].ID,
                        playertwo = team.Players[2].ID,
                        id = team.ID,
                        wins = team.Wins
                    };
                    context.Team.Add(current);
                    context.SaveChanges();
                }

                return 1;
            }
            catch (Exception ex)
            {
                return 0;
            }
        }