public async Task <IActionResult> Delete([FromRoute] int id) { APIResult apiResult; var record = await holuserService.GetAsync(id); var result = mapper.Map <HoluserDto>(record); if (record != null) { var isSuccessful = await holuserService.DeleteAsync(record); if (isSuccessful) { apiResult = APIResultFactory.Build(true, StatusCodes.Status202Accepted, ErrorMessageEnum.None, payload: result); } 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 RemoveThisRecord(bool NeedDelete) { if (NeedDelete == true) { await CurrentService.DeleteAsync(mapper.Map <Holuser>(CurrentNeedDeleteRecord)); dataGrid.RefreshGrid(); } ConfirmMessageBox.Hidden(); }