public IHttpActionResult GetVersionBeginEndDateAPI(string customer, string project, string productphase, string parttypes, int version, DateTime startDay, DateTime endDay) { var EnumEntity = EventReportManagerService.GetVersionBeginEndDate(customer, project, productphase, parttypes, version); if (EnumEntity != null) { if (DateTime.Compare(startDay.Date, EnumEntity.VersionBeginDate.Date) > 0) { EnumEntity.VersionBeginDate = startDay; } if (DateTime.Compare(endDay.Date, EnumEntity.VersionEndDate.Date) < 0 || EnumEntity.VersionEndDate.Date.ToShortDateString() == "1/1/0001") { EnumEntity.VersionEndDate = endDay; } if (DateTime.Compare(DateTime.Now.Date, EnumEntity.VersionEndDate.Date) == 0) { EnumEntity.VersionEndDate = DateTime.Now.AddDays(-1).Date; } EnumEntity.Interval = "从 " + EnumEntity.VersionBeginDate.ToShortDateString() + " 到 " + EnumEntity.VersionEndDate.ToShortDateString(); return(Ok(EnumEntity)); } else { return(Ok(EnumEntity)); } }