public ActionResult Create([Bind(Include = "ID_BenhNhan,HoTen,GioiTinh,NamSinh,DiaChi,Deleted")] HoSoBenhNhan hoSoBenhNhan)
        {
            if (ModelState.IsValid)
            {
                db.HoSoBenhNhans.Add(hoSoBenhNhan);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            List <SelectListItem> Gender = new List <SelectListItem>()
            {
                new SelectListItem
                {
                    Value = "true",
                    Text  = "Nam"
                },
                new SelectListItem
                {
                    Value = "false",
                    Text  = "Nữ"
                }
            };

            ViewBag.GioiTinh = new SelectList(Gender, "Value", "Text");
            return(View(hoSoBenhNhan));
        }
        // GET: HoSoBenhNhans/Edit/5
        public ActionResult Edit(int?id)
        {
            List <SelectListItem> Gender = new List <SelectListItem>()
            {
                new SelectListItem
                {
                    Value = "true",
                    Text  = "Nam"
                },
                new SelectListItem
                {
                    Value = "false",
                    Text  = "Nữ"
                }
            };


            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            HoSoBenhNhan hoSoBenhNhan = db.HoSoBenhNhans.Find(id);

            if (hoSoBenhNhan == null)
            {
                return(HttpNotFound());
            }
            ViewBag.GioiTinh = new SelectList(Gender, "Value", "Text");
            return(View(hoSoBenhNhan));
        }
예제 #3
0
        public ActionResult DeleteConfirmed(int id)
        {
            HoSoBenhNhan hoSoBenhNhan = db.HoSoBenhNhans.Find(id);

            db.HoSoBenhNhans.Remove(hoSoBenhNhan);
            db.SaveChanges();
            return(RedirectToAction("DanhSachKhamBenh", "HoSoBenhNhan"));
        }
예제 #4
0
 public ActionResult Edit([Bind(Include = "ID_BenhNhan,HoTen,GioiTinh,NamSinh,DiaChi,NgayKham")] HoSoBenhNhan hoSoBenhNhan)
 {
     if (ModelState.IsValid)
     {
         db.Entry(hoSoBenhNhan).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("DanhSachKhamBenh", "HoSoBenhNhan"));
     }
     return(View(hoSoBenhNhan));
 }
        // GET: HoSoBenhNhans/Delete/5
        public JsonResult DeleteConfirmation(int BenhNhanID)
        {
            bool         result = false;
            HoSoBenhNhan hoSo   = db.HoSoBenhNhans.Find(BenhNhanID);

            if (hoSo != null)
            {
                hoSo.Deleted = true;
                db.SaveChanges();
                result = true;
            }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
예제 #6
0
        // GET: HoSoBenhNhan/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            HoSoBenhNhan hoSoBenhNhan = db.HoSoBenhNhans.Find(id);

            if (hoSoBenhNhan == null)
            {
                return(HttpNotFound());
            }
            return(View(hoSoBenhNhan));
        }
예제 #7
0
        public JsonResult ConfirmThemMoiBenhNhan(string TenBenhNhan, string GioiTinh, string NgaySinh, string DiaChi)
        {
            int newIDBenhNhan = 0;

            if (TenBenhNhan != null && DiaChi != null && GioiTinh != null && NgaySinh != null)
            {
                HoSoBenhNhan benhNhan = new HoSoBenhNhan();
                benhNhan.HoTen    = TenBenhNhan;
                benhNhan.DiaChi   = DiaChi;
                benhNhan.GioiTinh = Convert.ToBoolean(GioiTinh);
                benhNhan.NamSinh  = Convert.ToDateTime(NgaySinh);
                db.HoSoBenhNhans.Add(benhNhan);
                db.SaveChanges();
                newIDBenhNhan = benhNhan.ID_BenhNhan;
            }
            return(Json(newIDBenhNhan, JsonRequestBehavior.AllowGet));
        }
예제 #8
0
        public ActionResult Create([Bind(Include = "ID_BenhNhan,HoTen,GioiTinh,NamSinh,DiaChi,NgayKham")] HoSoBenhNhan hoSoBenhNhan)
        {
            if (ModelState.IsValid)
            {
                if (hoSoBenhNhan.GioiTinh == true)
                {
                    Session["GioiTinh"] = "Nam";
                }
                else
                {
                    Session["GioiTinh"] = "Nữ";
                }
                db.HoSoBenhNhans.Add(hoSoBenhNhan);
                db.SaveChanges();
                //Session["NgayKham"] = hoSoBenhNhan.NgayKham;
                return(RedirectToAction("DanhSachKhamBenh", "HoSoBenhNhan"));
            }

            return(View(hoSoBenhNhan));
        }