Ejemplo n.º 1
0
        public MemberModel AddMember(MemberModel member)
        {
            MemberModel memberModel = new MemberModel();

            using (ChallengeEntities challengeEntities = new ChallengeEntities())
            {
                var memberModelData = JsonConvert.DeserializeObject <Member>(JsonConvert.SerializeObject(member));
                challengeEntities.Members.Add(memberModelData);
                challengeEntities.SaveChanges();
                memberModel = JsonConvert.DeserializeObject <MemberModel>(JsonConvert.SerializeObject(memberModelData));
            }

            return(memberModel);
        }
Ejemplo n.º 2
0
        public PlayersModel UpdatePlayer(PlayersModel player)
        {
            PlayersModel players = new PlayersModel();

            using (ChallengeEntities challengeEntities = new ChallengeEntities())
            {
                var playersData = challengeEntities.Players.Where(x => x.id == player.ID).FirstOrDefault();
                playersData = JsonConvert.DeserializeObject <Player>(JsonConvert.SerializeObject(player));
                challengeEntities.SaveChanges();
                players = JsonConvert.DeserializeObject <PlayersModel>(JsonConvert.SerializeObject(playersData));
            }

            return(players);
        }
Ejemplo n.º 3
0
        public SeriesModel UpdateSeries(SeriesModel series)
        {
            SeriesModel seriesModel = new SeriesModel();

            using (ChallengeEntities challengeEntities = new ChallengeEntities())
            {
                var seriesData = challengeEntities.Series.Where(x => x.id == series.ID).FirstOrDefault();
                seriesData = JsonConvert.DeserializeObject <Series>(JsonConvert.SerializeObject(seriesData));
                challengeEntities.SaveChanges();
                series = JsonConvert.DeserializeObject <SeriesModel>(JsonConvert.SerializeObject(seriesData));
            }

            return(series);
        }
Ejemplo n.º 4
0
        public PlayersModel AddPlayer(PlayersModel player)
        {
            PlayersModel players = new PlayersModel();

            using (ChallengeEntities challengeEntities = new ChallengeEntities())
            {
                var playersModelData = JsonConvert.DeserializeObject <Player>(JsonConvert.SerializeObject(player));
                challengeEntities.Players.Add(playersModelData);
                challengeEntities.SaveChanges();
                players = JsonConvert.DeserializeObject <PlayersModel>(JsonConvert.SerializeObject(playersModelData));
            }

            return(players);
        }
Ejemplo n.º 5
0
        public SeriesModel AddSeries(SeriesModel series)
        {
            SeriesModel seriesModel = new SeriesModel();

            using (ChallengeEntities challengeEntities = new ChallengeEntities())
            {
                var seriesModelData = JsonConvert.DeserializeObject <Series>(JsonConvert.SerializeObject(series));
                challengeEntities.Series.Add(seriesModelData);
                challengeEntities.SaveChanges();
                seriesModel = JsonConvert.DeserializeObject <SeriesModel>(JsonConvert.SerializeObject(seriesModelData));
            }

            return(seriesModel);
        }