Пример #1
0
 public static HrManagerContext GetInstance()
 {
     if (entity == null)
     {
         entity = new HrManagerContext();
     }
     return(entity);
 }
Пример #2
0
        public static DbSet <T> GetDbSetInstance <T>()
            where T : class
        {
            if (entity == null)
            {
                entity = new HrManagerContext();
            }
            var propInfo = typeof(HrManagerContext).GetProperty(typeof(T).Name + "s");

            return((DbSet <T>)propInfo.GetValue(entity, null));
        }
Пример #3
0
 public List <Attendance> GetAttendancesByMonth(int month)
 {
     return(HrManagerContext.GetInstance().Attendances.Where(a => a.RecordTimeToDateTime.Month == month).ToList());
 }
Пример #4
0
 public int Update()
 {
     return(HrManagerContext.GetInstance().SaveChanges());
 }
Пример #5
0
 public void Delete(T t)
 {
     currentDbset.Remove(t);
     HrManagerContext.GetInstance().SaveChanges();
 }
Пример #6
0
 public void Add(T t)
 {
     currentDbset.Add(t);
     HrManagerContext.GetInstance().SaveChanges();
 }