public ActionResult Edit(Employee obj)
        {
            EmployeeBusiness ob   = new EmployeeBusiness();
            Employee         test = ob.EditEmployee(obj);

            return(View(test));
            //  return RedirectToAction("Index", "Home");
        }
Esempio n. 2
0
        public ActionResult Edit([Bind(Include = "Id,name,gender,location")] Employee employee)
        {
            if (ModelState.IsValid)
            {
                employeeBusiness.EditEmployee(employee);
            }

            return(RedirectToAction("Index"));
        }
 private void btnAddData_Click(object sender, EventArgs e)
 {
     Employee.MaNhanVien  = int.Parse(txtEmployeeID.Text);
     Employee.TenNhanVien = txtEmployeeName.Text.Trim();
     Employee.Tuoi        = int.Parse(txtAge.Text);
     Employee.SoDT        = txtPhoneNumber.Text;
     Employee.GioiTinh    = cbGender.Text;
     Employee.MaLoaiNV    = int.Parse(cbEmployeeTypeID.SelectedValue.ToString());
     if (isAdd == true)
     {
         int result = EmployeeBusiness.AddEmployee(Employee);
         if (result == 1)
         {
             MessageBox.Show("Added successfully!", "Add a new Employee");
             pnlPostData.Hide();
         }
         else
         {
             MessageBox.Show("Failed to add a new Employee!", "Add a new Employee");
         }
     }
     else
     {
         int result = EmployeeBusiness.EditEmployee(Employee);
         if (result == 1)
         {
             MessageBox.Show("Edited successfully!", "Edit a Employee");
             pnlPostData.Hide();
         }
         else
         {
             MessageBox.Show("Failed to edit a Employee!", "Edit a Employee");
         }
     }
     loadData();
 }