public ActionResult doctorRegister(Doctortbl docRegModel) { dbPatientBillingEntities dbuserLogModel = new dbPatientBillingEntities(); usertbl usertblvals = new usertbl(); Doctortbl doctblvals = new Doctortbl(); using (dbPatientBillingEntities3 dbDoctorModel = new dbPatientBillingEntities3()) { if (dbDoctorModel.Doctortbls.Any(x => x.D_userName == docRegModel.D_userName)) { ViewBag.Duplicatemsg = "User already exist."; return(View("doctorRegister", docRegModel)); } else { doctblvals.Doctor_Name = docRegModel.Doctor_Name; doctblvals.Gender = docRegModel.Gender; doctblvals.PhoneNo = docRegModel.PhoneNo; doctblvals.D_email = docRegModel.D_email; doctblvals.specialization = docRegModel.specialization; doctblvals.Consultation_Fee = docRegModel.Consultation_Fee; doctblvals.userType = docRegModel.userType; usertblvals.userType = doctblvals.userType; doctblvals.D_userName = docRegModel.D_userName; usertblvals.userName = doctblvals.D_userName; doctblvals.D_Password = docRegModel.D_Password; usertblvals.userpassword = doctblvals.D_Password; } dbDoctorModel.Doctortbls.Add(doctblvals); dbuserLogModel.usertbls.Add(usertblvals); dbuserLogModel.SaveChanges(); dbDoctorModel.SaveChanges(); } ModelState.Clear(); ViewBag.SuccessMessage = "Registration Succesfull."; return(View("doctorRegister", new Doctortbl())); }
public ActionResult doctorRegister() { Doctortbl docRegModel = new Doctortbl(); return(View(docRegModel)); }