コード例 #1
0
 public void delete(Employee employee)
 {
     using(var transaction = session.BeginTransaction())
     {
         session.Delete(employee);
         transaction.Commit();
     }
 }
コード例 #2
0
 public void save(Employee employee)
 {
     using(var transaction = session.BeginTransaction())
     {
         session.SaveOrUpdate(employee);
         transaction.Commit();
     }
 }
コード例 #3
0
 public static Employee get_stub_employee_values()
 {
     Employee employee = new Employee
                             {
                                 FirstName = "Peter",
                                 LastName = "Gibbons"
                             };
     return employee;
 }
コード例 #4
0
        public virtual IEnumerable<Employee> AddEmployee(Employee employee)
        {
            if (Employees == null)
            {
                Employees = new HashedSet<Employee>();
            }

            Employees.Add(employee);

            return Employees;
        }
コード例 #5
0
        public virtual IEnumerable<Employee> RemoveEmployee(Employee employee)
        {
            if (Employees == null)
            {
                Employees = new HashedSet<Employee>();
            }
            else
            {
                Employees.Remove(employee);
            }

            return Employees;
        }
コード例 #6
0
        public ActionResult Create(FormCollection collection)
        {
            try
            {
                Employee employee = new Employee()
                                        {
                                            Id = -1,
                                            FirstName = collection["firstName"],
                                            LastName = collection["lastName"]
                                        };
                employee_repository.save(employee);

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
コード例 #7
0
 public void save(Employee employee)
 {
     throw new NotImplementedException();
 }
コード例 #8
0
 public virtual bool Equals(Employee other)
 {
     if (ReferenceEquals(null, other)) return false;
     if (ReferenceEquals(this, other)) return true;
     return other.Id == Id && Equals(other.FirstName, FirstName) && Equals(other.LastName, LastName);
 }