Пример #1
0
 public Sport Get(Guid id)
 {
     if (id != null)
     {
         return(Mapping.Mapped.Map <Dto.Sport>(_repository.Get <Domain.Entities.Sport>(id)));
     }
     return(null);
 }
        public void GetSportTest()
        {
            ISportRepository specific = (ISportRepository)sportStorage;

            sportStorage.Add(sportA);
            Sport sportInDb = specific.Get("SportA");

            Assert.AreEqual(sportA.Name, sportInDb.Name);
        }
        public ActionResult <IEnumerable <Sport> > GetValues()
        {
            var sports = _sportRepo.Get();

            if (sports == null)
            {
                return(NotFound("Getting null for sports"));
            }
            return(Ok(sports));
        }
 public ICollection <Tuple <TeamDto, int> > GetScoreTable(string sportName)
 {
     try
     {
         Sport asked = sportsStorage.Get(sportName);
         return(CalculateExistingSportTable(asked));
     }
     catch (SportNotFoundException e) {
         throw new ServiceException(e.Message, ErrorType.ENTITY_NOT_FOUND);
     }
 }
Пример #5
0
        private Sport GetSport(string sportName)
        {
            Sport stored;

            try
            {
                stored = sports.Get(sportName);
            }
            catch (SportNotFoundException e)
            {
                throw new ServiceException(e.Message, ErrorType.ENTITY_NOT_FOUND);
            }
            return(stored);
        }
Пример #6
0
 private Sport TryGetSport(string sportName)
 {
     try
     {
         return(sportsStorage.Get(sportName));
     }
     catch (SportNotFoundException e)
     {
         throw new ServiceException(e.Message, ErrorType.ENTITY_NOT_FOUND);
     }
     catch (DataInaccessibleException e) {
         throw new ServiceException(e.Message, ErrorType.DATA_INACCESSIBLE);
     }
 }
Пример #7
0
        public SportDto GetSport(string name)
        {
            authenticator.Authenticate();
            Sport fromStorage;

            try
            {
                fromStorage = sports.Get(name);
            }
            catch (SportNotFoundException e)
            {
                throw new ServiceException(e.Message, ErrorType.ENTITY_NOT_FOUND);
            }
            catch (DataInaccessibleException e) {
                throw new ServiceException(e.Message, ErrorType.DATA_INACCESSIBLE);
            }
            return(mapper.ToDto(fromStorage));
        }
 public void GetNotExistentTeamTest()
 {
     Sport teamInDb = sportStorage.Get("DreamSport");
 }
Пример #9
0
 public IQueryable <SportsTree> Get()
 {
     return(_sportRepository.Get());
 }