public async Task <CountResult> DeleteMemoAsync(string SessionKey, long Id) { return(await authorizationProcessor.DoAuthorizeAsync(SessionKey, async token => { var result = await billingMemoProcessor.DeleteAsync(Id, token); return new CountResult { ProcessResult = new ProcessResult { Result = true }, Count = result, }; }, logger)); }
/// <summary> /// 請求データ登録用 without transaction scope /// </summary> /// <param name="billing"></param> /// <param name="token"></param> /// <returns></returns> private async Task <Billing> SaveInnerAsync(Billing billing, CancellationToken token = default(CancellationToken)) { Billing result = null; if (billing.Id > 0) { var current = (await billingGetByIdsQueryProcessor.GetByIdsAsync(new long[] { billing.Id }, token)).FirstOrDefault(); if (current == null) { throw new Exception("請求データが存在しないため、修正できません。"); } if (current.AssignmentFlag != 0 || current.OutputAt != null || current.InputType == 3 || current.ResultCode == 0) { throw new Exception("修正不可能な請求データです。"); } else { result = await updatebillingQueryProcessor.UpdateAsync(billing, token); } } else { result = await addBillingQueryProcessor.AddAsync(billing, token); } if (string.IsNullOrEmpty(billing.Memo)) { await billingMemoProcessor.DeleteAsync(result.Id, token); } else { await billingMemoProcessor.SaveMemoAsync(result.Id, billing.Memo, token); } return(result); }
public async Task <int> DeleteMemo([FromBody] long Id, CancellationToken token) => await billingMemoProcessor.DeleteAsync(Id);