Exemplo n.º 1
0
        public ActionResult Create(Employee employee)
        {
            if (ModelState.IsValid)
            {
                db.Employees.AddObject(employee);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(employee);
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the Employees EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToEmployees(Employee employee)
 {
     base.AddObject("Employees", employee);
 }
 /// <summary>
 /// Create a new Employee object.
 /// </summary>
 /// <param name="employeeID">Initial value of the EmployeeID property.</param>
 /// <param name="logonID">Initial value of the LogonID property.</param>
 /// <param name="lastName">Initial value of the LastName property.</param>
 /// <param name="firstName">Initial value of the FirstName property.</param>
 /// <param name="status">Initial value of the Status property.</param>
 /// <param name="region">Initial value of the Region property.</param>
 /// <param name="createdDate">Initial value of the CreatedDate property.</param>
 /// <param name="createdBy">Initial value of the CreatedBy property.</param>
 public static Employee CreateEmployee(global::System.Int32 employeeID, global::System.String logonID, global::System.String lastName, global::System.String firstName, global::System.Boolean status, global::System.String region, global::System.DateTime createdDate, global::System.String createdBy)
 {
     Employee employee = new Employee();
     employee.EmployeeID = employeeID;
     employee.LogonID = logonID;
     employee.LastName = lastName;
     employee.FirstName = firstName;
     employee.Status = status;
     employee.Region = region;
     employee.CreatedDate = createdDate;
     employee.CreatedBy = createdBy;
     return employee;
 }
Exemplo n.º 4
0
 public ActionResult Edit(Employee employee)
 {
     if (ModelState.IsValid)
     {
         db.Employees.Attach(employee);
         db.ObjectStateManager.ChangeObjectState(employee, EntityState.Modified);
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(employee);
 }