public ActionResult Edit(NhanVien item) { try { TaiKhoan tk = (TaiKhoan)Session["USER_SESSION"]; int id = tk.MaTK; NhanVien nv = NhanVienMager.GetbyTK(id); nv.MaNVchinhsua = nv.MaNV; NhanVienMager.uppdate(item); return(RedirectToAction("Index")); } catch { return(RedirectToAction("Edit", item.MaNV)); } }
public ActionResult Delete(int?id, FormCollection f) { try { TaiKhoan tk = (TaiKhoan)Session["USER_SESSION"]; int idtk = tk.MaTK; NhanVien nv = NhanVienMager.GetbyTK(idtk); var itemxoa = NhanVienMager.delete(id); itemxoa.MaNVchinhsua = nv.MaNV; itemxoa.Ngaycapnhap = DateTime.Now; NhanVienMager.uppdate(itemxoa); return(RedirectToAction("Index")); } catch { return(RedirectToAction("Delete", id)); } }