// GET: Employees public ActionResult Index() { DPGenericRepository <Employees> employeesRepository = new DPGenericRepository <Employees>(conn); return(View(employeesRepository.All())); }
// GET: Department public ActionResult Index() { DPGenericRepository <Department> departmentRepository = new DPGenericRepository <Department>(conn); return(View(departmentRepository.All())); }
// GET: Employees/Create public ActionResult Create() { DPGenericRepository <Department> departmentRepository = new DPGenericRepository <Department>(conn); ViewBag.DepartmentID = new SelectList(departmentRepository.All(), "DepartmentID", "Name"); return(View()); }
public void All_OK() { conn = new SqlConnection(Settings.connectionString); var instance = new DPGenericRepository <GEIN_CORTES_SERVICIO>(conn); IEnumerable <GEIN_CORTES_SERVICIO> result = instance.All(); Assert.NotNull(result); }
public ActionResult Create([Bind(Exclude = "EmployeesID")] Employees employees) { DPGenericRepository <Department> departmentRepository = new DPGenericRepository <Department>(conn); DPGenericRepository <Employees> employeesRepository = new DPGenericRepository <Employees>(conn); if (ModelState.IsValid) { employeesRepository.Add(employees); return(RedirectToAction("Index")); } ViewBag.DepartmentID = new SelectList(departmentRepository.All(), "DepartmentID", "Name", employees.DepartmentID); return(View(employees)); }
// GET: Employees/Edit/5 public ActionResult Edit(int?id) { DPGenericRepository <Department> departmentRepository = new DPGenericRepository <Department>(conn); if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } DPGenericRepository <Employees> employeesRepository = new DPGenericRepository <Employees>(conn); object pk = new { EmployeesID = id }; if (employeesRepository.Find(pk) == null) { return(HttpNotFound()); } Employees employees = new Employees(); ViewBag.DepartmentID = new SelectList(departmentRepository.All(), "DepartmentID", "Name", employees.DepartmentID); return(View(employeesRepository.Find(pk))); }
public void All() { var result = repositoryEmployees.All(); Assert.IsNotNull(result); }