public override void Update(PlayerGame playerGame) { PlayerRepo pr = new PlayerRepo(); TeamRepo tr = new TeamRepo(); GameRepo gr = new GameRepo(); if (null != pr.FindBy(p => p.UserName == playerGame.Player.UserName).FirstOrDefault()) { pr.Add(playerGame.Player); pr.Save(); } if (null != tr.FindBy(p => p.Id == playerGame.Team.Id).FirstOrDefault()) { tr.Add(playerGame.Team); tr.Save(); } if (null != gr.FindBy(g => g.Name == playerGame.GameName).FirstOrDefault()) { gr.Add(playerGame.Game); gr.Save(); } Context.PlayerGames.Update(playerGame); Save(); }
public IActionResult Post([FromBody] Team newTeam) { _logger.Log($"add team"); if (newTeam == null) { return(HttpBadRequest("couldn't serialise value")); } _logger.Log($"adding release with key: {newTeam.Key}"); TeamRepo.Add(newTeam); return(CreatedAtRoute("GetTeam", new { controller = "Team", key = newTeam.Key }, newTeam)); }