Пример #1
0
        public ActionResult <SkierOutDto> GetById(int id)
        {
            Skier skier = _adoSkierDao.FindById(id);

            if (skier == null)
            {
                return(NotFound());
            }
            return(Ok(SkierOutDto.FromSkier(skier)));
        }
Пример #2
0
        public ActionResult <SkierOutDto> Update(int id, SkierInDto skierInDto)
        {
            Skier skier = SkierInDto.ToSkier(skierInDto);

            skier.Id = id;
            _adoSkierDao.Update(skier);
            var updatedSkier = _adoSkierDao.FindById(id);

            if (updatedSkier == null)
            {
                return(NotFound());
            }
            return(Ok(SkierOutDto.FromSkier(updatedSkier)));
        }
Пример #3
0
        public ActionResult <IEnumerable <SkierOutDto> > GetAll()
        {
            IEnumerable <Skier> skiers = _adoSkierDao.FindAll();

            if (skiers == null)
            {
                return(NotFound());
            }
            IList <SkierOutDto> skierDtos = new List <SkierOutDto>();

            foreach (var skier in skiers)
            {
                skierDtos.Add(SkierOutDto.FromSkier(skier));
            }
            return(Ok(skierDtos));
        }