Esempio n. 1
0
 /// <summary>
 /// Delete 1 record là xóa luôn record khỏi database
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public bool Delete(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.Delete(cat);
             repo.SaveChanges();
             return(true);
         }
         catch
         {
             return(false);
         }
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Delete 1 record là xóa luôn record khỏi database
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public bool Delete(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.Delete(cat);
                    repo.SaveChanges();
                    return true;
                }
                catch
                {
                    return false;
                }

            }
        }