public ActionResult GiangVien(List <GiangVien> ls) { GiangVienService gv = new GiangVienService(); ls = gv.GetAll().ToList(); return(View(ls)); }
public ActionResult Save(FormCollection f) { GiangVienService gv = new GiangVienService(); GiangVien s = new GiangVien(); s.TenGiangVien = f["txtname"]; if (f["txtGT"].Equals("Nam")) { s.Gioitinh = ComMon_BaiTapLon.EnumsHelper.GioitinhEnum.Nam; /*f["txtGT"];*/ } if (f["txtGT"].Equals("Nu")) { s.Gioitinh = ComMon_BaiTapLon.EnumsHelper.GioitinhEnum.Nu; } else { s.Gioitinh = ComMon_BaiTapLon.EnumsHelper.GioitinhEnum.Khac; } s.ChuyenNganh = f["txtCN"]; s.Ngaysinh = DateTime.Parse(f["txtNS"]); s.Diachi = f["txtDC"]; s.Email = f["txtEM"]; gv.Add(s); List <GiangVien> lsgv = new List <GiangVien>(); lsgv = gv.GetAll().ToList(); return(RedirectToAction("Index", new { ls = lsgv })); }
public ActionResult Edit(FormCollection f1) { GiangVienService gv = new GiangVienService(); GiangVien s = new GiangVien(); s.TenGiangVien = f1["txtname1"]; if (f1["sl1"].Equals("Nam")) { s.Gioitinh = ComMon_BaiTapLon.EnumsHelper.GioitinhEnum.Nam; } if (f1["sl1"].Equals("Nu")) { s.Gioitinh = ComMon_BaiTapLon.EnumsHelper.GioitinhEnum.Nu; } else { s.Gioitinh = ComMon_BaiTapLon.EnumsHelper.GioitinhEnum.Khac; } s.ChuyenNganh = f1["txtCN1"]; s.Ngaysinh = DateTime.Parse(f1["txtNS1"]); s.Diachi = f1["txtDC1"]; s.Email = f1["txtEM1"]; List <GiangVien> lsgv = new List <GiangVien>(); lsgv = gv.GetAll().ToList(); gv.Update(s); return(RedirectToAction("Index", new { ls = lsgv })); }