// POST: api/CheckTotalRecord public async Task <IHttpActionResult> Get(string StartDateTime) { VerityResult result = new VerityResult(); try { SearchTime modelTime = new SearchTime { StartDateTime = DateTime.Parse(StartDateTime), }; var totalRecord = await _totalRecord.CheckTotalRecord(modelTime); result.Success = true; result.Message = "更新彙總紀錄成功"; return(new ResponseMessageResult(Request.CreateResponse(HttpStatusCode.OK, result))); } catch (Exception ex) { result.Success = false; result.Message = JsonConvert.SerializeObject(ex); return(new ResponseMessageResult(Request.CreateResponse(HttpStatusCode.InternalServerError, result))); throw; } }
/// <summary> /// 編輯打卡紀錄的時間 /// </summary> /// <param name="model"></param> /// <param name="time"></param> /// <returns></returns> public async Task <JsonResult> SubmitClick_In(CheckRecordViewModel model, UpdateCheckTimeViewModel time) { ResponseViewModel res = new ResponseViewModel(); try { if (time != null) { if (time.ci_ut != "-") { model.ci_ut = TimeSpan.Parse(time.ci_ut); } if (time.ci_dt != "-") { model.ci_dt = TimeSpan.Parse(time.ci_dt); } var result = await _checkRecord.SubmitClick_In(model); SearchTime modelTime = new SearchTime { StartDateTime = DateTime.Parse(model.ci_da.ToString("s")), }; var totalRecord = _totalRecord.CheckTotalRecord(modelTime); res.Success = result.Success; res.Message = result.Message; res.HttpStatusCode = System.Net.HttpStatusCode.OK; } } catch (Exception ex) { res.Exception = ex; res.Success = false; res.Message = "與伺服器連接發生錯誤"; res.HttpStatusCode = System.Net.HttpStatusCode.InternalServerError; } res.ResponseTime = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"); return(Json(res, JsonRequestBehavior.AllowGet)); }