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 LeaveCategoryService.GetAsync(id); var result = mapper.Map <LeaveCategoryDto>(record); if (record != null) { #region 刪除記錄前的紀錄完整性檢查 VerifyRecordResult verify = await LeaveCategoryService.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 LeaveCategoryService.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)); }
public async Task <bool> DeleteLeaveCategoriesAsync(int id) { var isDeleted = await m_leaveCategoryService.DeleteAsync(id); return(isDeleted); }