コード例 #1
0
        public ActionResult Create(FormCollection f)
        {
            HOC_SINH hs    = new HOC_SINH();
            var      MA_HS = db.HOC_SINH.Find("2000000001");

            if (MA_HS == null)
            {
                hs.MA_HS = "2000000001";
            }
            else
            {
                int ma = int.Parse(db.HOC_SINH.Select(m => m.MA_HS).ToList().Last()) + 1;
                hs.MA_HS = ma.ToString();
            }
            hs.HO_TEN    = f["name"];
            hs.SDT       = f["SDT"];
            hs.NG_SINH   = Convert.ToDateTime(f["ngaysinh"]);
            hs.GIOI_TINH = f["Gioitinh"];
            hs.TRUONG    = f["truong"];
            hs.PHU_HUYNH = f["phuhuynh"];
            hs.DIA_CHI   = f["diachi"];
            hs.KHOI      = int.Parse(f["khoi"]);
            db.HOC_SINH.Add(hs);
            bASE.create_TAI_KHOAN(hs.MA_HS);
            db.SaveChanges();
            return(View());
        }
コード例 #2
0
        public ActionResult DeleteConfirmed(string id)
        {
            HOC_SINH hOC_SINH = db.HOC_SINH.Find(id);

            db.HOC_SINH.Remove(hOC_SINH);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #3
0
 public ActionResult Edit([Bind(Include = "MA_HS,HO_TEN,NG_SINH,GIOI_TINH,KHOI,TRUONG,SDT,DIA_CHI,PHU_HUYNH")] HOC_SINH hOC_SINH)
 {
     if (ModelState.IsValid)
     {
         db.Entry(hOC_SINH).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.MA_HS = new SelectList(db.TAI_KHOAN, "TAI_KHOAN1", "MAT_KHAU", hOC_SINH.MA_HS);
     return(View(hOC_SINH));
 }
コード例 #4
0
        // GET: Admin/HOC_SINH/Details/5
        public ActionResult Details(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            HOC_SINH hOC_SINH = db.HOC_SINH.Find(id);

            if (hOC_SINH == null)
            {
                return(HttpNotFound());
            }
            return(View(hOC_SINH));
        }
コード例 #5
0
        //=========================================================
        // GET: Admin/HOC_SINH/Edit/5
        public ActionResult Edit(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            HOC_SINH hOC_SINH = db.HOC_SINH.Find(id);

            if (hOC_SINH == null)
            {
                return(HttpNotFound());
            }
            ViewBag.MA_HS = new SelectList(db.TAI_KHOAN, "TAI_KHOAN1", "MAT_KHAU", hOC_SINH.MA_HS);
            return(View(hOC_SINH));
        }