Esempio n. 1
0
        public async Task<ActionResult> AddRecommendation(RecommendationViewModel viewModel)
        {
            var doctor = await _doctorService.GetByUserIdAsync(User.Identity.GetUserId());
            var patient = await _patientService.GetByIdAsync(1);
            if (ModelState.IsValid)
            {
                Recommendation recommendation = new Recommendation()
                {
                    CreateDate = DateTime.Now,
                    RecommendationText = viewModel.RecommendationText,
                    DoctorId = doctor.Id,
                    PatientId = patient.Id
                };

                await _recommendationService.CreateAsync(recommendation);
                return new EmptyResult();
            }
            return PartialView("_AddRecommendationDialog", viewModel);
        }
Esempio n. 2
0
 public void Delete(Recommendation recommendation)
 {
     _recommendationRepository.Delete(recommendation);
     _unitOfWork.SaveChangesAsync();
 }
Esempio n. 3
0
 public async Task<Recommendation> AddAttachment(Attachment attachment, Recommendation recommendation)
 {
     recommendation.Attachments.Add(attachment);
     await _unitOfWork.SaveChangesAsync();
     return recommendation;
 }
Esempio n. 4
0
 public async Task<Recommendation> UpdateAsync(Recommendation recommendation)
 {
     _recommendationRepository.Update(recommendation);
     await _unitOfWork.SaveChangesAsync();
     return recommendation;
 }