Beispiel #1
0
 public void AddEmployee(EmpModel employee)
 {
     Employee e = new Employee() { Name = employee.Name };
     context.Employees.Add(e);
     context.SaveChanges();
 }
Beispiel #2
0
 public void UpdateEmployee(Employee employee)
 {
     context.Entry(employee).State = EntityState.Modified;
     context.SaveChanges();
 }
Beispiel #3
0
 public ActionResult Search(Employee emp)
 {
     if (emp.Name == null)
     {
         return PartialView("_searchEmployees", _repository.GetEmployees());
     }
     else
     {
         return PartialView("_searchEmployees",
                             _repository.GetEmployees()
                             .Where(e => e.Name.ToLower()
                             .Contains(emp.Name.ToLower())));
     }
 }