Ejemplo n.º 1
0
        public Player Edit(Player editPlayer)
        {
            Player player = _repo.Get(editPlayer.Id);

            if (player == null)
            {
                throw new Exception("Invalid Id");
            }
            player.Name   = editPlayer.Name;
            player.TeamId = editPlayer.TeamId;
            _repo.Edit(player);
            return(player);
        }
Ejemplo n.º 2
0
        internal Player Edit(Player update)
        {
            Player exists = _repo.GetById(update.Id);

            if (exists == null)
            {
                throw new Exception("Invalid Id");
            }
            if (exists.CreatorId != update.CreatorId)
            {
                throw new Exception("I can't let you do that");
            }
            _repo.Edit(update);
            return(update);
        }