Exemple #1
0
        public SportDto AddSport(SportDto dto)
        {
            authenticator.AuthenticateAdmin();
            Sport toAdd = TryCreate(dto);

            try {
                sports.Add(toAdd);
            }
            catch (SportAlreadyExistsException e) {
                throw new ServiceException(e.Message, ErrorType.ENTITY_ALREADY_EXISTS);
            }
            catch (DataInaccessibleException e) {
                throw new ServiceException(e.Message, ErrorType.DATA_INACCESSIBLE);
            }
            return(dto);
        }