public static HrManagerContext GetInstance() { if (entity == null) { entity = new HrManagerContext(); } return(entity); }
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)); }
public List <Attendance> GetAttendancesByMonth(int month) { return(HrManagerContext.GetInstance().Attendances.Where(a => a.RecordTimeToDateTime.Month == month).ToList()); }
public int Update() { return(HrManagerContext.GetInstance().SaveChanges()); }
public void Delete(T t) { currentDbset.Remove(t); HrManagerContext.GetInstance().SaveChanges(); }
public void Add(T t) { currentDbset.Add(t); HrManagerContext.GetInstance().SaveChanges(); }