public ActionResult AddEmployee(Employee model) { if (ModelState.IsValid) { if (model.EmpNo == 0) { if (EmpCls.AddEmployee(model, model.EmpNo) == 0) { ViewBag.Message = "Duplicate Name"; Employee obj = new Employee(); return(View(obj)); } } else { if (EmpCls.UpdateEmployee(model, model.EmpNo) == 0) { ViewBag.Message = "Duplicate Name"; Employee obj = new Employee(); return(View(obj)); } } } return(RedirectToAction("ManageEmployee")); }
public ActionResult AddEmployee(int EmpNo = 0) { GetEmployeeListData(); // ViewBag.PCountryDD = Common.GetCountryMst(); // ViewBag.PStateDD = Common.GetStateMst(); // ViewBag.PCityDD = Common.GetCityMst(); Employee obj = new Employee(); if (EmpNo != 0) { obj = EmpCls.GetEmployee(EmpNo); } return(View(obj)); }
public ActionResult RemoveEmployee(int EmpNo = 0) { Boolean Del; EmpCls CObj = new EmpCls(); Del = CObj.RemoveEmployee(EmpNo); if (Del == true) { return(RedirectToAction("ManageEmployee")); } else { return(HttpNotFound()); } }
//public Employee() // cannot declare parameterless constructor //{ // cls = new EmpCls(); //} public Employee(string name) { cls = new EmpCls(); this.Name = name; cls.Name = name; }
public ActionResult ManageEmployee() { return(View(EmpCls.GetEmployee())); }