示例#1
0
        public ActionResult AddEmployee(DashBoard.Models.EmployeeModel model)
        {
            if (ModelState.IsValid)
            {
                DATA.Domains.Employee employee = new DATA.Domains.Employee
                {
                    CellNo       = model.CellNo,
                    CNIC         = model.CNIC,
                    FirstName    = model.FirstName,
                    LastName     = model.LastName,
                    DepartmentId = model.DepartmentId,
                    CreatedOn    = DateTime.Now,
                    IsActive     = true,
                    IsDeleted    = false
                };
                employeeProvider.AddEmployee(employee);

                TempData["alert"] = GetAlert("Employee added successfully", "success");
            }
            else
            {
                TempData["alert"] = GetAlert("Employee not added successfully", "error");
            }

            var departments = employeeProvider.GetDepartments();

            TempData["Departments"] = departments;

            return(View());
        }
示例#2
0
        public ActionResult Update(DATA.Domains.Employee employee)
        {
            try
            {
                employeeProvider.UpdateEmployee(employee);
                TempData["alert"] = GetAlert("Employee updated successfully", "success");
            }
            catch (Exception ex)
            {
                TempData["alert"] = GetAlert(ex.Message, "error");
            }

            return(RedirectToAction("GetEmployees"));
        }