public CompanyUnitOfWork(CompanyContext context) { this.context = context; Employee = new RepositoryEmployee(context); Department = new RepositoryDepartment(context); Task = new RepositoryTask(context); }
public ActionResult AddOrEdit(int id = 0) { if (id == 0) { return(View()); } else { return(View(DapperORM.ReturnList <Employee>("EmployeeViewByID", RepositoryEmployee.EditList(id)).FirstOrDefault <Employee>())); } }
public void GetEmployees_TypeofEmployees_WithRealData() { // Arrange IRepositoryEmployee <EmployeeLib.Employee> realRepository = new RepositoryEmployee(); EmployeeController controller = new EmployeeController(realRepository); var result = controller.Index() as ViewResult; var modelType = result.Model.GetType(); Assert.AreEqual(typeof(IQueryable), modelType.GetType()); // Act var emp = realRepository.GetEmployees(); // Assert -> checking the type of the repo Assert.AreEqual(typeof(List <EmployeeLib.Employee>), emp.GetType()); }
public ActionResult Download() { var fileContent = RepositoryEmployee.Download(); return(File(fileContent, "text/plain", "Data.txt")); }
public ActionResult Delete(int id) { RepositoryEmployee.Delete(id); return(RedirectToAction("Index")); }
public ActionResult AddOrEdit(Employee employee, int DivId) { RepositoryEmployee.EditExecutor(employee, DivId); return(RedirectToAction("Index")); }
public ActionResult Index() { return(View(RepositoryEmployee.List())); }
public EntityEmployee Update(EntityEmployee model) { var data = new RepositoryEmployee().Update(model); return(data); }
public EntityEmployee Insert(EntityEmployee model) { var data = new RepositoryEmployee().Insert(model); return(data); }