Exemple #1
0
 /// <summary>
 /// Thêm mới một record
 /// </summary>
 /// <param name="cat"></param>
 /// <returns></returns>
 public bool Add(Cat_DayOff cat)
 {
     using (var context = new VnrAttendanceDataContext())
     {
         IUnitOfWork unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
         Cat_DayOffRepository repo = new Cat_DayOffRepository(unitOfWork);
         try
         {
             repo.Add(cat);
             repo.SaveChanges();
             return true;
         }
         catch
         {
             return false;
         }
     }
 }
Exemple #2
0
 /// <summary>
 /// Edit một record
 /// </summary>
 /// <param name="cat"></param>
 /// <returns></returns>
 public bool Edit(Cat_DayOff cat)
 {
     using (var context = new VnrAttendanceDataContext())
     {
         IUnitOfWork          unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
         Cat_DayOffRepository repo       = new Cat_DayOffRepository(unitOfWork);
         try
         {
             repo.Edit(cat);
             repo.SaveChanges();
             return(true);
         }
         catch
         {
             return(false);
         }
     }
 }
Exemple #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);
         }
     }
 }
Exemple #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;
                }

            }
        }