// 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())); }
public void Initialize() { /// Create Repository connection = new SqlConnection(conectionString); repositoryEmployees = new DPGenericRepository <Employees> (connection); repositoryDepartments = new DPGenericRepository <Departments>(connection); }
// GET: Employees/Create public ActionResult Create() { DPGenericRepository <Department> departmentRepository = new DPGenericRepository <Department>(conn); ViewBag.DepartmentID = new SelectList(departmentRepository.All(), "DepartmentID", "Name"); return(View()); }
public async void AllAsync_OK() { conn = new SqlConnection(Settings.connectionString); var instance = new DPGenericRepository <GEIN_CORTES_SERVICIO>(conn); IEnumerable <GEIN_CORTES_SERVICIO> result = await instance.AllAsync(); 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/Details/5 public ActionResult Details(int?id) { 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()); } return(View(employeesRepository.Find(pk))); }
// GET: Department/Details/5 public ActionResult Details(int?id) { DPGenericRepository <Department> departmentRepository = new DPGenericRepository <Department>(conn); object pk = new { DepartmentID = id }; if (pk == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } if (departmentRepository.Find(pk) == null) { return(HttpNotFound()); } return(View(departmentRepository.Find(pk))); }
public ActionResult Edit(int id, Employees employees) { DPGenericRepository <Employees> employeesRepository = new DPGenericRepository <Employees>(conn); object pk = new { EmployeesID = id }; //DPGenericRepository<Department> departmentRepository = new DPGenericRepository<Department>(conn); //ViewBag.DepartmentID = new SelectList(departmentRepository.All(), "DepartmentID", "Name", employees.DepartmentID); if (ModelState.IsValid) { employeesRepository.Update(employees, pk); return(RedirectToAction("Index")); } 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 Add3_GoodParameter_OK() { conn = new SqlConnection(Settings.connectionString); var instance = new DPGenericRepository <GEIN_CORTES_SERVICIO>(conn); var fechaHis = new GEIN_CORTES_SERVICIO { FechaInicio = DateTime.Today, FechaFin = DateTime.Today, IdDepartamento = "D", Incidencia = "i", Subject = "SBJ-2", Persona = "p" }; int result = instance.Add(fechaHis); Assert.Equal(1, result); }