Ejemplo n.º 1
0
        public ActionResult Create(Employee employee)
        {
            if (string.IsNullOrEmpty(employee.Name))
            {
                ModelState.AddModelError("Name","Nombre");
            }
            if (ModelState.IsValid)
            {
                db.tblEmployee.AddObject(employee);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.DepartmentId = new SelectList(db.tblDepartment, "Id", "Name", employee.DepartmentId);
            return View(employee);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Create a new Employee object.
 /// </summary>
 /// <param name="employeeId">Initial value of the EmployeeId property.</param>
 public static Employee CreateEmployee(global::System.Int32 employeeId)
 {
     Employee employee = new Employee();
     employee.EmployeeId = employeeId;
     return employee;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the tblEmployee EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTotblEmployee(Employee employee)
 {
     base.AddObject("tblEmployee", employee);
 }