public async Task <Result <List <string> > > getLineUDChangedData(TimeQueryModel condition) { return(checkTimeFormat(condition) ? await Task.Factory.StartNew(() => dao.getLineUDChangedData(condition.startTime, condition.endTime)) : new Result <List <string> > { success = false, message = "时间格式不正确" }); }
public async Task <IHttpActionResult> GetChangedData_LineStation([FromUri] TimeQueryModel condition) { Result <List <string> > result = new Result <List <string> >(); if (condition == null) { result.addError("参数为空"); return(Content(System.Net.HttpStatusCode.Accepted, result)); } result = await service.getLineStationChangedData(condition); return(Ok(result)); }
private bool checkTimeFormat(TimeQueryModel condition) { DateTime date; try { date = DateTime.ParseExact(condition.startTime, "yyyy-MM-dd HH:mm:ss", System.Globalization.CultureInfo.CurrentCulture); date = DateTime.ParseExact(condition.endTime, "yyyy-MM-dd HH:mm:ss", System.Globalization.CultureInfo.CurrentCulture); return(true); } catch (Exception) { return(false); } }