public ActionResult GetRecordByMonth(DateTime?start) { StatisticLogic slogic = new StatisticLogic(); DateTime now = DateTime.Now; DateTime startTime; DateTime endTime; DateTime current = start.Value; if (start == null) { startTime = now.AddDays(1 + (-now.Day)).AddHours(-now.Hour).AddMinutes(-now.Minute).AddSeconds(-now.Second); endTime = now.AddMonths(1).AddDays(-now.Day).AddHours(23 - now.Hour).AddMinutes(59 - now.Minute).AddSeconds(59 - now.Second); } else { startTime = current.AddDays(1 + (-current.Day)).AddHours(-current.Hour).AddMinutes(-current.Minute).AddSeconds(-current.Second); endTime = current.AddMonths(1).AddDays(-current.Day).AddHours(23 - current.Hour).AddMinutes(59 - current.Minute).AddSeconds(59 - current.Second); } var result = slogic.GetRecordByMonth(startTime, endTime, Guid.Empty); return(Json(result)); }