protected void btnAdd_Click(object sender, EventArgs e) { Employ employ = new Employ(); try { employ.Empno = Convert.ToInt32(txtEmpno.Text); employ.Name = txtname.Text; employ.Department = txtDept.Text; employ.Designation = txtDesig.Text; employ.Basic = Convert.ToInt32(txtbasic.Text); bool status = EmployBLL.AddEmployBLL(employ); if (status) { ScriptManager.RegisterStartupScript(this, this.GetType(), "M1", "alert('Employ Details Added')", true); txtEmpno.Text = ""; txtname.Text = ""; txtDept.Text = ""; txtDesig.Text = ""; txtbasic.Text = ""; } } catch (Exception ex) { ScriptManager.RegisterStartupScript(this, this.GetType(), "M1", "alert('" + ex.Message + "')", true); } }
public ActionResult Create(Employ employ) { bool status = EmployBLL.AddEmployBLL(employ); if (status) { return(RedirectToAction("Index", "Employ")); } return(View()); }