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

            Employees.Add(employee);

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

            return Employees;
        }
        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();
            }
        }
 public void save(Employee employee)
 {
     throw new NotImplementedException();
 }
Example #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);
 }