Esempio n. 1
0
        public async Task <IActionResult> CreateRecommendation([FromBody] RecommendationResource recommendationResource)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var recommendation = mapper.Map <RecommendationResource, Recommendation>(recommendationResource);

            recommendationRepository.AddRecommendation(recommendation);

            recommendation.BoardEnrollment = await boardEnrollmentRepository.GetBoardEnrollment(recommendationResource.BoardEnrollmentId);

            await unitOfWork.Complete();

            recommendation = await recommendationRepository.GetRecommendation(recommendation.RecommendationId);

            var result = mapper.Map <Recommendation, RecommendationResource>(recommendation);

            return(Ok(result));
        }
 public int AddRecommendation(Recommendation recommendation)
 {
     return(repo.AddRecommendation(recommendation));
 }