public ActionResult CapSoKhamBenh(int id, benhnhanEntity a, FormCollection fc) { var bs = fc["bacsi"]; var axx = new ServiceReference1.benhnhanEntity(); axx.mabenhnhan = id; axx.HoTenBenhNhan = a.HoTenBenhNhan; axx.SDT = a.SDT; axx.Tuoi = (int)a.Tuoi; axx.DiaChi = a.DiaChi; if (ModelState.IsValid) { ur.UpdateUser(axx); var pk = new ServiceReference1.phieuKhamEntity(); pk.maBenhNhan = id; pk.maBacSi = int.Parse(bs); pk.trangThai = "Đang Chờ"; if (ur.AddPhieuKham(pk) == 2) { return(null); } else { ur.AddPhieuKham(pk); return(RedirectToAction("Create", "NhanVienNhanBenh")); } // return RedirectToAction("Create", "NhanVienNhanBenh"); } return(RedirectToAction("Create", "NhanVienNhanBenh")); }
public ActionResult Create(benhnhanEntity a) { var ax = new ServiceReference1.benhnhanEntity(); ax.mabenhnhan = a.mabenhnhan; ax.HoTenBenhNhan = a.HoTenBenhNhan; ax.SDT = a.SDT; ax.Tuoi = a.Tuoi; ax.DiaChi = a.DiaChi; if (ModelState.IsValid) { ur.AddUser(ax); return(RedirectToAction("Index")); } return(View(a)); }
public ActionResult Edit(int id, benhnhanEntity a) { var axx = new ServiceReference1.benhnhanEntity(); axx.mabenhnhan = id; axx.HoTenBenhNhan = a.HoTenBenhNhan; axx.SDT = a.SDT; axx.Tuoi = (int)a.Tuoi; axx.DiaChi = a.DiaChi; if (ModelState.IsValid) { ur.UpdateUser(axx); return(RedirectToAction("Create", "NhanVienNhanBenh")); } return(RedirectToAction("Create", "NhanVienNhanBenh")); }
public ActionResult Edit(int id, benhnhanEntity a) { var ax = ur.GetAllUserById(id); var axx = new ServiceReference1.benhnhanEntity(); axx.mabenhnhan = a.mabenhnhan; axx.HoTenBenhNhan = a.HoTenBenhNhan; axx.SDT = a.SDT; axx.Tuoi = (int)a.Tuoi; axx.DiaChi = a.DiaChi; if (ModelState.IsValid) { ur.UpdateUser(axx); return(RedirectToAction("Index")); } return(View(ax)); }
public ActionResult Create(benhnhanEntity a, FormCollection fc) { var bs = fc["bacsi"]; var ax = new ServiceReference1.benhnhanEntity(); ax.HoTenBenhNhan = a.HoTenBenhNhan; ax.SDT = a.SDT; ax.Tuoi = a.Tuoi; ax.DiaChi = a.DiaChi; if (ModelState.IsValid) { var pk = new ServiceReference1.phieuKhamEntity(); //pk.maBenhNhan = ax.mabenhnhan; pk.maBacSi = int.Parse(bs); pk.trangThai = "Đang Chờ"; //ur.AddPhieuKham(pk); ur.AddUserPhieuKham(ax, pk); return(RedirectToAction("Create", "NhanVienNhanBenh")); } return(RedirectToAction("Create", "NhanVienNhanBenh")); }