예제 #1
0
        public async Task <ActionResult <PlayersModel> > PostPlayersModel(PlayersModel playersModel)
        {
            _context.PlayersModel.Add(playersModel);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetPlayersModel", new { id = playersModel.PlayerId }, playersModel));
        }
예제 #2
0
        public async Task <IActionResult> PutPlayersModel(int id, PlayersModel playersModel)
        {
            if (id != playersModel.PlayerId)
            {
                return(BadRequest());
            }

            _context.Entry(playersModel).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PlayersModelExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
예제 #3
0
 protected override void OnLoadStart()
 {
     inGameplayModel = Model.First <InGamePlayModel>();
     playersModel    = Model.First <PlayersModel>();
     Debug.Log(TAG + "OnLoadComplete");
     SetLoadComplete();
 }
예제 #4
0
        public async Task <ActionResult> EditPlayer(int Id)
        {
            var playerManager = new PlayerManager(ConfigurationManager.ConnectionStrings["WhosOnFirstDb"].ConnectionString);
            var personManager = new PersonManager(ConfigurationManager.ConnectionStrings["WhosOnFirstDb"].ConnectionString);
            var playerModel   = new Players();
            var player        = new PlayersModel();
            var person        = new Person();

            playerModel = await playerManager.RetrieveAsync(Id);

            player.PlayerId          = Id;
            player.PersonId          = playerModel.PersonId;
            player.PositionRequested = playerModel.PositionRequested;
            player.TeamRequested     = playerModel.TeamRequested;
            player.JerseyNumber      = playerModel.JerseyNumber;
            player.Note      = playerModel.Note;
            player.IsPitcher = playerModel.IsPitcher;
            person           = await personManager.RetrieveAsync(playerModel.PersonId);

            player.FirstName   = person.FirstName;
            player.LastName    = person.LastName;
            player.PhoneNumber = person.PhoneNumber;
            player.EMail       = person.EMail;
            player.IsPlayer    = person.IsPlayer;
            player.IsCoach     = person.IsCoach;
            player.IsValid     = person.IsValid;
            player.IsAdmin     = person.IsAdmin;
            player.TeamId      = person.TeamId;

            return(View(player));
        }
예제 #5
0
        public ActionResult EditPlayer(PlayersModel editedPlayers)
        {
            var playerManager = new PlayerManager(ConfigurationManager.ConnectionStrings["WhosOnFirstDb"].ConnectionString);
            var personManager = new PersonManager(ConfigurationManager.ConnectionStrings["WhosOnFirstDb"].ConnectionString);
            var playerModel   = new Players();
            var person        = new Person();

            //playerModel = playerManager.Retrieve(editedPlayers.PersonId);
            playerModel.PlayerId          = editedPlayers.PlayerId;
            playerModel.PositionRequested = editedPlayers.PositionRequested;
            playerModel.TeamRequested     = editedPlayers.TeamRequested;
            playerModel.JerseyNumber      = editedPlayers.JerseyNumber;
            playerModel.Note      = editedPlayers.Note;
            playerModel.IsPitcher = editedPlayers.IsPitcher;
            playerModel.PersonId  = editedPlayers.PersonId;
            playerManager.Update(playerModel);
            person.PersonId    = editedPlayers.PersonId;
            person.FirstName   = editedPlayers.FirstName;
            person.LastName    = editedPlayers.LastName;
            person.PhoneNumber = editedPlayers.PhoneNumber;
            person.EMail       = editedPlayers.EMail;
            person.IsPlayer    = editedPlayers.IsPlayer;
            person.IsCoach     = editedPlayers.IsCoach;
            person.IsValid     = editedPlayers.IsValid;
            person.IsAdmin     = editedPlayers.IsAdmin;
            person.TeamId      = editedPlayers.TeamId;
            personManager.Update(person);

            return(RedirectToAction("ViewTeamPlayers"));
        }
예제 #6
0
 protected override void OnLoadStart()
 {
     settingModel    = Model.First <SettingModel>();
     playersModel    = Model.First <PlayersModel>();
     inGameplayModel = Model.First <InGamePlayModel>();
     cameraModel     = Model.First <CameraModel>();
     SetLoadComplete();
 }
예제 #7
0
        public IHttpActionResult GetPlayerDetails(int PlayerId)
        {
            PlayersModel players     = new PlayersModel();
            var          playerModel = new PlayersDataModel();

            players = playerModel.GetPlayerById(PlayerId);
            return(Ok(players));
        }
예제 #8
0
        public async Task GetPlayers(IHttpContext context)
        {
            Authenticator.VerifyAuth(context);

            var players = await Dispatcher.RunOnMainThread(() => PlayersModel.GetPlayers());

            await context.SendResponse(HttpStatusCode.OK, players);
        }
예제 #9
0
        public ActionResult DeleteConfirmed(int id)
        {
            PlayersModel playersModel = db.APlayer.Find(id);

            db.APlayer.Remove(playersModel);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #10
0
        public IHttpActionResult UpdatePlayer([FromBody] PlayersModel player)
        {
            PlayersModel players     = new PlayersModel();
            var          playerModel = new PlayersDataModel();

            players = playerModel.UpdatePlayer(player);
            return(Ok(players));
        }
        public async Task <ActionResult <IEnumerable <string> > > GetPlayersCredentials(string emailId)
        {
            var playersModel = new PlayersModel();

            playersModel.writeEmail(emailId);

            return(Ok("Email Sent To Your MailID" + " " + emailId));
        }
예제 #12
0
        // GET: Players/Create
        public ActionResult Create()
        {
            string Narrator_id = db.AspNetUsers.SingleOrDefault(u => u.Email == User.Identity.Name).Id;

            ViewBag.Narrator_id = Narrator_id;
            PlayersModel playerModel = new PlayersModel(Narrator_id);

            return(View(playerModel));
        }
예제 #13
0
 protected override void OnLoadStart()
 {
     inGameplayModel       = Model.First <InGamePlayModel>();
     playersModel          = Model.First <PlayersModel>();
     levelSettingModel     = Model.First <MissionLevelSettingModel>();
     touchBallSettingModel = Model.First <TouchBallSettingModel>();
     Debug.Log(TAG + "OnLoadStart");
     SetLoadComplete();
 }
예제 #14
0
 public ActionResult Edit([Bind(Include = "ID,PlayerName,G,PTS,TRB,AST,FG,FG3,FT,eFG,PER,WS")] PlayersModel playersModel)
 {
     if (ModelState.IsValid)
     {
         db.Entry(playersModel).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(playersModel));
 }
예제 #15
0
        // GET: Players
        public ActionResult Index()
        {
            var model = new PlayersModel();

            model.SelectedTableStyle = "greenTable";
            model.TotalCount         = _playerBusiness.GetAllPlayersCount();
            model.CurrentPage        = 1;

            return(Index(model));
        }
예제 #16
0
        public ActionResult Create([Bind(Include = "ID,PlayerName,G,PTS,TRB,AST,FG,FG3,FT,eFG,PER,WS")] PlayersModel playersModel)
        {
            if (ModelState.IsValid)
            {
                db.APlayer.Add(playersModel);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(playersModel));
        }
예제 #17
0
        public static StatusPayload FromServer()
        {
            var payload = new StatusPayload()
            {
                playerCount = PlayersModel.GetPlayers().Count,
                lastSave    = SettingsModel.LastSave?.ToString("s", System.Globalization.CultureInfo.InvariantCulture),
                gameStatus  = SettingsModel.GameStatus.ToString()
            };

            return(payload);
        }
예제 #18
0
        public async Task KickPlayer(IHttpContext context, ulong steamId, KickPlayerPayload body)
        {
            Authenticator.VerifyAuth(context);

            var payload = await Dispatcher.RunOnMainThread(() => PlayersModel.KickPlayer(steamId, body.reason));

            if (payload == null)
            {
                throw new NotFoundException("No player exist by the given SteamID.");
            }

            await context.SendResponse(HttpStatusCode.OK, payload);
        }
예제 #19
0
        public ActionResult View()
        {
            // check access
            if (VerifyAccess())
            {
                return(RedirectToAction("Index", "Home"));
            }
            PlayerService ps = new PlayerService(FILENAME);
            PlayersModel  pm = new PlayersModel();

            pm.Players = ps.GetPlayer();

            return(View(pm));
        }
예제 #20
0
        // GET: PlayersModels/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PlayersModel playersModel = db.APlayer.Find(id);

            if (playersModel == null)
            {
                return(HttpNotFound());
            }
            return(View(playersModel));
        }
예제 #21
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);
        }
예제 #22
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);
        }
예제 #23
0
        // GET: Players/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            string       Narrator_id = db.AspNetUsers.SingleOrDefault(u => u.Email == User.Identity.Name).Id;
            PlayersModel playerModel = new PlayersModel();

            playerModel.Player          = db.Players.Find(id);
            playerModel.AllStories      = db.Stories.Where(s => s.Narrator_id == Narrator_id).ToList();
            playerModel.UserStories     = db.Players.Find(id).Stories.ToList();
            playerModel.SelectedStories = db.Players.Find(id).Stories.Select(x => x.System_id).ToArray();
            return(View(playerModel));
        }
예제 #24
0
        public async Task <IActionResult> Put(PlayersModel player)
        {
            if (ModelState.IsValid)
            {
                context.Update(new Player()
                {
                    PlayerId  = player.Id,
                    FirstName = player.firstName,
                    LastName  = player.lastName
                });
                await context.SaveChangesAsync();

                return(Ok(player));
            }
            return(BadRequest(ModelState));
        }
예제 #25
0
        private ActionResult Index(PlayersModel model)
        {
            GetPlayers(model, model.CurrentPage);
            ViewBag.SelectedStyle = model.SelectedTableStyle;

            model.EnableNextPage     = model.CurrentPage >= 1 && (model.CurrentListOfPlayers.Count == PageSize);
            model.EnablePreviousPage = model.CurrentPage > 1;

            if (model.CurrentListOfPlayers.Count == PageSize)
            {
                SetupMessage(model, model.CurrentPage * PageSize);
            }
            else
            {
                SetupMessage(model, model.TotalCount);
            }

            return(View("Index", model));
        }
예제 #26
0
        public void PlayerPost(List <string> players)
        {
            PlayersModel player = new PlayersModel()
            {
                Name = players[10],
                G    = players[9],
                PTS  = players[8],
                TRB  = players[7],
                AST  = players[6],
                FG   = players[5],
                FG3  = players[4],
                FT   = players[3],
                eFG  = players[2],
                PER  = players[1],
                WS   = players[0]
            };

            db.APlayer.Add(player);
            db.SaveChanges();
        }
예제 #27
0
        public ActionResult Update(PlayersModel player)
        {
            string constr = ConfigurationManager.ConnectionStrings["Constring"].ConnectionString;

            using (SqlConnection con = new SqlConnection(constr))
            {
                string query = "INSERT INTO players(name, surname, email, date) VALUES(@Name, @Surname, @Email, @date)";
                using (SqlCommand cmd = new SqlCommand(query))
                {
                    cmd.Connection = con;
                    con.Open();
                    cmd.Parameters.AddWithValue("@Name", player.name);
                    cmd.Parameters.AddWithValue("@Surname", player.surname);
                    cmd.ExecuteNonQuery();
                    con.Close();
                }
            }

            return(View(player));
        }
예제 #28
0
        public ActionResult Edit(PlayersModel playerModel)
        {
            if (ModelState.IsValid)
            {
                if (playerModel.Player.Type == "NPC Group")
                {
                    playerModel.Player.eMail = "";
                }
                db.Entry(playerModel.Player).State = EntityState.Modified;
                db.SaveChanges();

                foreach (Story s in db.Stories)
                {
                    if (playerModel.SelectedStories != null)
                    {
                        if (s.Players.Contains(playerModel.Player) && !playerModel.SelectedStories.Contains(s.System_id))
                        {
                            s.Players.Remove(playerModel.Player);
                            db.Players.Find(playerModel.Player.System_Id).Stories.Remove(s);
                        }
                        else if (!s.Players.Contains(playerModel.Player) && playerModel.SelectedStories.Contains(s.System_id))
                        {
                            s.Players.Add(playerModel.Player);
                            db.Players.Find(playerModel.Player.System_Id).Stories.Add(s);
                        }
                    }
                    else
                    {
                        s.Players.Remove(playerModel.Player);
                        db.Players.Find(playerModel.Player.System_Id).Stories.Remove(s);
                    }
                }
                db.SaveChanges();

                return(RedirectToAction("Narrator", "Administration", null));
            }

            ViewBag.Types  = new SelectList(new GetSelectList(PlayerTypes));
            ViewBag.Status = new SelectList(new GetSelectList(Status));
            return(View(playerModel));
        }
예제 #29
0
        public async Task BanPlayer(IHttpContext context, ulong steamId, BanPlayerPayload body)
        {
            Authenticator.VerifyAuth(context);

            var bannedPlayer = await Dispatcher.RunOnMainThread(() =>
            {
                var player = PlayersModel.GetPlayer(steamId);
                if (player != null)
                {
                    BansModel.AddBan(steamId, body.hours, body.reason);
                }
                return(player);
            });

            if (bannedPlayer == null)
            {
                throw new NotFoundException("No player exist by the given SteamID.");
            }

            await context.SendResponse(HttpStatusCode.OK, bannedPlayer);
        }
예제 #30
0
        public PlayersModel GetPlayerById(int PlayerId)
        {
            PlayersModel players = new PlayersModel();

            using (ChallengeEntities challengeEntities = new ChallengeEntities())
            {
                var playersData = (from pl in challengeEntities.Players
                                   join n in challengeEntities.Nationalities on pl.Nationality equals n.id
                                   where pl.id == PlayerId
                                   select new { pl, n }).ToList();
                if (playersData != null && playersData.Count > 0)
                {
                    foreach (var eachRow in playersData)
                    {
                        players             = JsonConvert.DeserializeObject <PlayersModel>(JsonConvert.SerializeObject(eachRow.pl));
                        players.nationality = JsonConvert.DeserializeObject <NationalityModel>(JsonConvert.SerializeObject(eachRow.n));
                    }
                }
            }
            return(players);
        }