public IActionResult CreateDiseaseHistory(PatientViewModel model) { var result = Execute(() => { bool isMedEmployee = _userManager.IsUserInMedEmployeeRole(User.Identity.Name); if (!isMedEmployee) { throw new UnauthorizedAccessException("You have not appropriate rights to access this action"); } var patientUserInfo = _userInfoService.RegisterPatient(model); var diseaseHistory = new DiseaseHistory() { PatientInfoId = patientUserInfo.UserInfoId, PatientInfo = patientUserInfo, Message = model.Message }; _diseaseHistoryService.AddDiseaseHistory(diseaseHistory); }); return(Json(result)); }