// // GET: /Home/ public ActionResult Index() { EmployeeContext employeeContext = new EmployeeContext(); ViewBag.Departments = new SelectList(employeeContext.Departments, "Department_Id", "name"); return View(); }
public void Guardar(Employee employee) { EmployeeContext employeeContext = new EmployeeContext(); employeeContext.Employees.Add(employee); employeeContext.SaveChanges(); }
public void Delete(int id) { EmployeeContext employeeContext = new EmployeeContext(); Employee employee = employeeContext.Employees.Single(emp => emp.EmployeeId == id); employeeContext.Employees.Remove(employee); employeeContext.SaveChanges(); }
// // GET: /Department/ public ActionResult Index() { EmployeeContext employeeContext = new EmployeeContext(); List<Department> departments = employeeContext.Departments.ToList(); return View(departments); }
// // GET: /Employee/ public ActionResult Details(int id) { EmployeeContext employeeContext = new EmployeeContext(); Employee employee = employeeContext.Employees.Single(emp => emp.EmployeeId == id); return View(employee); }
public void SaveEmployee(Employee employee) { EmployeeContext employeeContext = new EmployeeContext(); Employee empleado = employeeContext.Employees.First(emp => emp.EmployeeId == employee.EmployeeId); empleado.city = employee.city; empleado.Department = employee.Department; empleado.gender = employee.gender; empleado.name= employee.name; employeeContext.SaveChanges(); }
public ActionResult EmployeesByDepartment() { EmployeeContext employeeContext = new EmployeeContext(); var employees = employeeContext.Employees.Include("Department") .GroupBy(x => x.Department.name) .Select(y => new DepartmentTotals { name = y.Key, total = y.Count() }).ToList(); return View(employees); }
public ActionResult Index() { EmployeeContext employeeContext = new EmployeeContext(); List<Employee> employees = employeeContext.Employees.ToList(); return View(employees); }
public IEnumerable<Employee> Employees() { EmployeeContext employeeContext = new EmployeeContext(); return employeeContext.Employees.ToList(); }