public IActionResult GetTheRecord(CarManageRecord carManageRecord) { try { var theModel = _cMSCarManageRecordDAO .FindSingle(x => x.LicenseNumber == carManageRecord.LicenseNumber && x.SignInDate == carManageRecord.SignInDate); return(Ok(theModel)); } catch (Exception ex) { return(StatusCode(500, $"Internal server error: {ex}.")); } }
public async Task <IActionResult> EditRecord(CarManageRecord model) { try { _cMSCarManageRecordDAO.Update(model); await _cMSCarManageRecordDAO.SaveAll(); return(Ok(model)); } catch (Exception ex) { return(StatusCode(500, $"Internal server error: {ex}.")); } }
public IActionResult getLastRecord(CarManageRecord carManageRecord) { try { var theModel = _cMSCarManageRecordDAO .FindAll(x => x.LicenseNumber == carManageRecord.LicenseNumber) .OrderByDescending(x => x.SignInDate).Take(1).ToList().FirstOrDefault(); return(Ok(theModel)); } catch (Exception ex) { return(StatusCode(500, $"Internal server error: {ex}.")); } }
public async Task <IActionResult> SignOutRecord(CarManageRecord model) { try { model.SignOutDate = Extensions.GetDateTimeNowInMillionSec(); _cMSCarManageRecordDAO.Update(model); await _cMSCarManageRecordDAO.SaveAll(); return(Ok(model)); } catch (Exception ex) { return(StatusCode(500, $"Internal server error: {ex}.")); } }
public async Task <IActionResult> AddRecord(CarManageRecord model) { try { //取到秒的Datetime //DateTime nowFormat = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, // DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second); model.SignInDate = Extensions.GetDateTimeNowInMillionSec(); _cMSCarManageRecordDAO.Add(model); await _cMSCarManageRecordDAO.SaveAll(); return(Ok(model)); } catch (Exception ex) { return(StatusCode(500, $"Internal server error: {ex}.")); } }