public static Rating ToRatingWithTestimonialDbObject(AddTestimonialViewModel testimonialViewModel, int studentId, int internshipId) { return(new Rating() { StudentId = studentId, InternshipId = internshipId, Testimonial = testimonialViewModel.Testimonial }); }
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))); }