public AttendanceRule Save(AttendanceRule entity)
        {
            if (entity == null)
            {
                return(null);
            }

            try
            {
                var rep = new AttendanceRuleRepository(db);
                if (entity.ID == Guid.Empty)
                {
                    entity.ID         = Guid.NewGuid();
                    entity.CreateUser = HttpContext.Current.User.Identity.Name;
                    entity.UpdateUser = HttpContext.Current.User.Identity.Name;
                    rep.Insert(entity);
                    db.SaveChanges();
                }
                else
                {
                    entity.UpdateTime = DateTime.Now;
                    entity.UpdateUser = HttpContext.Current.User.Identity.Name;
                    rep.Update(entity);
                    db.SaveChanges();
                }

                return(entity);
            }
            catch (Exception exp)
            {
                throw exp;
            }
        }
        public AttendanceRule Delete(AttendanceRule entiry)
        {
            var rep = new AttendanceRuleRepository(db);

            rep.Delete(entiry);
            db.SaveChanges();
            return(entiry);
        }
        public IEnumerable <AttendanceRule> Query()
        {
            var rep = new AttendanceRuleRepository(db);

            return(rep.Get(null, x => x.OrderBy(y => y.CreateTime)));
        }