//private readonly ApplicationdbContect _db = new ApplicationdbContect(); // GET: PatientSignature public async Task <ActionResult> Index(string patientIdstr) { int patientId = Convert.ToInt32(HelperExtensions.Decrypt(patientIdstr)); var patientConsent = await _db.PatientProfile_Consent.Where(x => x.PatientId == patientId).FirstOrDefaultAsync(); if (patientConsent != null) { return(PartialView(patientConsent)); } else { var ConsentTemplate = await _db.PatientProfile_ConsentTemplate.FirstAsync(); return(View(new PatientProfile_Consent { PatientId = patientId, Consent = ConsentTemplate.ConsentTemplate })); } }