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 team) { var result = _teamRepo.Save(team); return(Ok(result)); }