Example #1
0
        public ActionResult <TestimonialViewModel> AddTestimonialToInternship(int id, [FromBody] AddTestimonialViewModel testimonialViewModel)
        {
            var userId           = User.GetUserId();
            var student          = _studentService.GetStudentByUserId(userId);
            var studentId        = student.Id;
            var internshipId     = id;
            var addedTestimonial = _internshipService
                                   .AddTestimonial(StudentRatingsMapper.ToRatingWithTestimonialDbObject(testimonialViewModel, studentId, internshipId));

            return(Ok(StudentRatingsMapper.ToTestimonial(addedTestimonial)));
        }
Example #2
0
        public ActionResult <AddRatingViewModel> AddRatingToInternship(int id, [FromBody] AddRatingViewModel ratingViewModel)
        {
            var userId       = User.GetUserId();
            var student      = _studentService.GetStudentByUserId(userId);
            var studentId    = student.Id;
            var internshipId = id;
            var addedRating  = _internshipService
                               .AddRating(StudentRatingsMapper.ToRatingDbObject(ratingViewModel, studentId, internshipId));

            return(Ok(StudentRatingsMapper.ToAddRatingViewModel(addedRating)));
        }