public async Task RemoveThisRecord(bool NeedDelete) { if (NeedDelete == true) { await CurrentService.DeleteAsync(CurrentNeedDeleteRecord.Id); dataGrid.RefreshGrid(); } ConfirmMessageBox.Hidden(); }
public async Task <IActionResult> Delete([FromRoute] int id) { APIResult apiResult; var record = await WorkingLogDetailService.GetAsync(id); var result = mapper.Map <WorkingLogDetailDto>(record); if (record != null) { #region 刪除記錄前的紀錄完整性檢查 VerifyRecordResult verify = await WorkingLogDetailService.BeforeDeleteCheckAsync(record); if (verify.Success == false) { apiResult = APIResultFactory.Build(false, StatusCodes.Status200OK, ErrorMessageMappingHelper.Instance.GetErrorMessage(verify.MessageId), payload: result); return(Ok(apiResult)); } #endregion var verifyRecordResult = await WorkingLogDetailService.DeleteAsync(id); if (verifyRecordResult.Success) { apiResult = APIResultFactory.Build(true, StatusCodes.Status202Accepted, ErrorMessageEnum.None, payload: null); } else { apiResult = APIResultFactory.Build(false, StatusCodes.Status200OK, ErrorMessageEnum.無法刪除紀錄, payload: result); } } else { apiResult = APIResultFactory.Build(false, StatusCodes.Status200OK, ErrorMessageEnum.沒有任何符合資料存在, payload: result); } return(Ok(apiResult)); }