Esempio n. 1
0
        public List <RehabilitationDTO> GetRehabilitationsList(int childCardId)
        {
            var childCard = _unitOfWork.ChildrenCardsRepository
                            .Get(card => card.Id == childCardId)
                            .AsNoTracking()
                            .Single();
            var rehabilitationsSortedByDate = childCard.Rehabilitations.OrderBy(rehabilitation => rehabilitation.BeginDate);

            return(RehabilitationDTOHelper.EntitiesToDTOs(rehabilitationsSortedByDate.ToList()));
        }
Esempio n. 2
0
        public RehabilitationDTO AddRehabilitationIntoChildCard(int childCardId,
                                                                RehabilitationDTO rehabilitationDTO)
        {
            var childCard = _unitOfWork.ChildrenCardsRepository
                            .Get(card => card.Id == childCardId)
                            .Single();
            var rehabilitation = RehabilitationDTOHelper.DTOToEntity(rehabilitationDTO);

            _unitOfWork.RehabilitationsRepository.Add(rehabilitation);
            childCard.Rehabilitations.Add(rehabilitation);
            _unitOfWork.Save();

            return(RehabilitationDTOHelper.EntityToDTO(rehabilitation));
        }