public async Task <int> Post(PaymentDispositionNotePostDto form) { List <int> listIds = form.ListIds.Select(x => x.Id).ToList(); foreach (int id in listIds) { var model = await ReadByIdAsync(id); if (model != null) { model.SetIsPosted(IdentityService.Username, UserAgent); foreach (var item in model.Items) { await SetTrueDisposition(item.DispositionNo); } await _autoDailyBankTransactionService.AutoCreateFromPaymentDisposition(model); } } var result = await DbContext.SaveChangesAsync(); return(result); }
public async Task Should_Success_Post() { PaymentDispositionNoteService service = new PaymentDispositionNoteService(GetServiceProvider().Object, _dbContext(GetCurrentMethod())); PaymentDispositionNotePostDto dto = await _dataUtil(service, GetCurrentMethod()).GetNewPostDto(); var Response = await service.Post(dto); Assert.NotEqual(0, Response); }
public async Task <IActionResult> PaymentDispositionNotePost([FromBody] PaymentDispositionNotePostDto form) { try { VerifyUser(); var result = await Service.Post(form); return(Ok(result)); } catch (Exception e) { Dictionary <string, object> Result = new ResultFormatter(ApiVersion, General.INTERNAL_ERROR_STATUS_CODE, e.Message) .Fail(); return(StatusCode(General.INTERNAL_ERROR_STATUS_CODE, Result)); } }