Exemplo n.º 1
0
 public CompanyUnitOfWork(CompanyContext context)
 {
     this.context = context;
     Employee     = new RepositoryEmployee(context);
     Department   = new RepositoryDepartment(context);
     Task         = new RepositoryTask(context);
 }
Exemplo n.º 2
0
 public ActionResult AddOrEdit(int id = 0)
 {
     if (id == 0)
     {
         return(View());
     }
     else
     {
         return(View(DapperORM.ReturnList <Employee>("EmployeeViewByID", RepositoryEmployee.EditList(id)).FirstOrDefault <Employee>()));
     }
 }
Exemplo n.º 3
0
        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());
        }
Exemplo n.º 4
0
        public ActionResult Download()
        {
            var fileContent = RepositoryEmployee.Download();

            return(File(fileContent, "text/plain", "Data.txt"));
        }
Exemplo n.º 5
0
 public ActionResult Delete(int id)
 {
     RepositoryEmployee.Delete(id);
     return(RedirectToAction("Index"));
 }
Exemplo n.º 6
0
 public ActionResult AddOrEdit(Employee employee, int DivId)
 {
     RepositoryEmployee.EditExecutor(employee, DivId);
     return(RedirectToAction("Index"));
 }
Exemplo n.º 7
0
 public ActionResult Index()
 {
     return(View(RepositoryEmployee.List()));
 }
Exemplo n.º 8
0
        public EntityEmployee Update(EntityEmployee model)
        {
            var data = new RepositoryEmployee().Update(model);

            return(data);
        }
Exemplo n.º 9
0
        public EntityEmployee Insert(EntityEmployee model)
        {
            var data = new RepositoryEmployee().Insert(model);

            return(data);
        }