Exemplo n.º 1
0
 /// <summary>
 /// Lấy dữ liệu theo Id
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public Cat_DayOff GetById(int id)
 {
     using (var context = new VnrAttendanceDataContext())
     {
         IUnitOfWork unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
         Cat_DayOffRepository repo = new Cat_DayOffRepository(unitOfWork);
         var catdayoff= repo.GetById(id);
         if (catdayoff.IsDelete == true) catdayoff = null;
         return catdayoff;
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Lấy dữ liệu theo Id
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public Cat_DayOff GetById(int id)
 {
     using (var context = new VnrAttendanceDataContext())
     {
         IUnitOfWork          unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
         Cat_DayOffRepository repo       = new Cat_DayOffRepository(unitOfWork);
         var catdayoff = repo.GetById(id);
         if (catdayoff.IsDelete == true)
         {
             catdayoff = null;
         }
         return(catdayoff);
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// Remove 1 record là chuyển trạng thái IsDelete=true
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public bool Remove(int id)
 {
     using (var context = new VnrAttendanceDataContext())
     {
         IUnitOfWork          unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
         Cat_DayOffRepository repo       = new Cat_DayOffRepository(unitOfWork);
         var cat = repo.GetById(id);
         try
         {
             repo.Remove(cat);
             repo.SaveChanges();
             return(true);
         }
         catch
         {
             return(false);
         }
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// Remove 1 record là chuyển trạng thái IsDelete=true
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public bool Remove(int id)
        {
            using (var context = new VnrAttendanceDataContext())
            {
                IUnitOfWork unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
                Cat_DayOffRepository repo = new Cat_DayOffRepository(unitOfWork);
                var cat = repo.GetById(id);
                try
                {
                    repo.Remove(cat);
                    repo.SaveChanges();
                    return true;
                }
                catch
                {
                    return false;
                }

            }
        }