public ActionResult AddRecommendationStartDialog(string id) { RecommendationViewModel model = new RecommendationViewModel() { PatientUserId = id }; return PartialView("_AddRecommendationDialog", model); }
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); }
public async Task<ActionResult> CreateRecommendation(RecommendationViewModel recommendation) { if (ModelState.IsValid) { var doctor = _doctorService.GetByUserIdAsync(User.Identity.GetUserId()); return PartialView("Recommendations"); } return new HttpStatusCodeResult(400); }