Beispiel #1
0
        public IQueryable<Cat_EmployeeType> GetCatEmployeeTypes()
        {
            using (var context = new VnrHrmHrDataContext())
            {
                IUnitOfWork unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
                Cat_EmployeeTypeRepository repo = new Cat_EmployeeTypeRepository(unitOfWork);
                return repo.GetAllCatEmployeeTypes().Where(i => i.IsDelete == null);

            }
        }
Beispiel #2
0
 public Cat_EmployeeType GetByIdCatEmployeeTypes(int id)
 {
     using (var context = new VnrHrmHrDataContext())
     {
         IUnitOfWork unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
         Cat_EmployeeTypeRepository repo = new Cat_EmployeeTypeRepository(unitOfWork);
         Cat_EmployeeType CatEmployeeType = new Cat_EmployeeType();
         CatEmployeeType = repo.GetById(id);
         if (CatEmployeeType.IsDelete == true) CatEmployeeType = null;
         return CatEmployeeType;
     }
 }
Beispiel #3
0
 public bool AddCatEmployeeTypes(Cat_EmployeeType CatEmployeeType)
 {
     using (var context = new VnrHrmHrDataContext())
     {
         IUnitOfWork unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
         Cat_EmployeeTypeRepository repo = new Cat_EmployeeTypeRepository(unitOfWork);
         try
         {
             repo.Add(CatEmployeeType);
             repo.SaveChanges();
             return true;
         }
         catch
         {
             return false;
         }
     }
 }
Beispiel #4
0
        public bool DeleteCatEmployeeType(int CatEmployeeTypeId)
        {
            using (var context = new VnrHrmHrDataContext())
            {
                IUnitOfWork unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
                Cat_EmployeeTypeRepository repo = new Cat_EmployeeTypeRepository(unitOfWork);
                Cat_EmployeeType CatEmployeeType = new Cat_EmployeeType();
                CatEmployeeType = repo.GetById(CatEmployeeTypeId);
                try
                {
                    repo.Remove(CatEmployeeType);
                    repo.SaveChanges();
                    return true;
                }
                catch
                {
                    return false;
                }

            }
        }