public ActionResult OperatorList() { dbPatientBillingEntities2 dbOperator = new dbPatientBillingEntities2(); var operatorTbl = dbOperator.Operatortbls.ToList(); //ViewBag.operatortList = OperatorTbl; return(View(operatorTbl)); }
public ActionResult Operator() { dbPatientBillingEntities2 db = new dbPatientBillingEntities2(); var username = db.Operatortbls.ToList(); foreach (var item in username) { if (Session["userName"] != null) { if (Session["userName"].Equals(item.O_userName)) { ViewBag.user = (string)item.Operator_Name; break; } } else { Response.Redirect("~/User/Index"); } } return(View()); }
public ActionResult operatorRegister(Operatortbl operRegModel) { dbPatientBillingEntities dbuserLogModel = new dbPatientBillingEntities(); usertbl usertblvals = new usertbl(); Operatortbl opertblvals = new Operatortbl(); using (dbPatientBillingEntities2 dbPatientModel = new dbPatientBillingEntities2()) { if (dbPatientModel.Operatortbls.Any(x => x.O_userName == operRegModel.O_userName)) { ViewBag.Duplicatemsg = "User already exist."; return(View("patientRegister", operRegModel)); } else { opertblvals.Operator_Name = operRegModel.Operator_Name; opertblvals.Gender = operRegModel.Gender; opertblvals.PhoneNo = operRegModel.PhoneNo; opertblvals.PhoneNo = operRegModel.PhoneNo; opertblvals.O_email = operRegModel.O_email; opertblvals.O_address = operRegModel.O_address; opertblvals.userType = operRegModel.userType; usertblvals.userType = opertblvals.userType; opertblvals.O_userName = operRegModel.O_userName; usertblvals.userName = opertblvals.O_userName; opertblvals.O_Password = operRegModel.O_Password; usertblvals.userpassword = opertblvals.O_Password; } dbPatientModel.Operatortbls.Add(opertblvals); dbuserLogModel.usertbls.Add(usertblvals); dbuserLogModel.SaveChanges(); dbPatientModel.SaveChanges(); } ModelState.Clear(); ViewBag.SuccessMessage = "Registration Succesfull."; return(View("operatorRegister", new Operatortbl())); }