public ResponseModel GetUniqueVisitorByDate(DateTime aDate) { try { //var selectedData = // _aRepository.SelectAll().Where(a => a.AuditTime != null && a.IsAdmin != true && a.AuditTime.Value.Date.ToString("MM/dd/yyyy") == aDate.ToString("MM/dd/yyyy")); using (var context = new EntitiesCms()) { var data = context.Database.SqlQuery <AuditVM>(String.Format(@"select convert(varchar,AuditDate, 6) AuditDate ,IpAddress,PcName,Browser,OsInfo,COUNT(*) Count from ( select CAST(AuditTime AS DATE) AuditDate, ISNULL(IsAdmin,0)Admin, * from Audit where CAST(AuditTime AS DATE) = CAST('{0}' AS DATE) ) tbl where Admin!=1 group by AuditDate,IpAddress,PcName,Browser,OsInfo", aDate.AddHours(12))).ToList(); //Audit _audit = new Audit() //{ // Message = aDate.ToString()+ data.Count.ToString(), // IsAdmin = true //}; //_aRepository.Insert(_audit); //_aRepository.Save(); return(_aModel.Respons(data)); // public string AuditDate { get; set; } //public string Count { get; set; } } } catch (Exception ex) { //Audit _audit =new Audit() //{ // Message = ex.Message, // IsAdmin = true //}; //_aRepository.Insert(_audit); //_aRepository.Save(); return(null); } }
public GenericRepositoryCms() { _db = new EntitiesCms(); _aTable = _db.Set <T>(); }
public GenericRepositoryCms(EntitiesCms db) { _db = db; _aTable = _db.Set <T>(); }