예제 #1
0
        public Team Edit(Team editTeam)
        {
            Team team = _repo.Get(editTeam.Id);

            if (team == null)
            {
                throw new Exception("Invalid Id");
            }
            team.Name   = editTeam.Name;
            team.Mascot = editTeam.Mascot;
            _repo.Edit(team);
            return(team);
        }
예제 #2
0
        internal Team Edit(Team update)
        {
            Team 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);
        }