public ActionResult DoctorVisit([FromForm] Visit visits) { var patients = PatientTable.GetPatientById(patientId); DateTime time = DateTime.Now.Date; string date = time.ToString("yyyy-MM-dd"); if (visits.Type == "visit") { visits.Status = "in progress"; } else if (visits.Type == "referral") { visits.Status = "pending"; } else if (visits.Type == "test") { TestTable.InsertData(patientId, Properties.UserId, "", date); visits.Status = "pending"; } VisitTable.InsertD(patients[0].Id, Properties.UserId, visits.Type, visits.Doctor, visits.Status, date); return(RedirectToAction("DoctorView", "Doctor", PatientTable.GetPatientById(patientId)[0])); }