public ActionResult <SkierOutDto> GetById(int id) { Skier skier = _adoSkierDao.FindById(id); if (skier == null) { return(NotFound()); } return(Ok(SkierOutDto.FromSkier(skier))); }
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))); }
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)); }