public async Task <ActionResult> FinanceOperation(FeeAcceptanceViewModel viewModel) { var claim = await _claimsRepository.GetClaim(viewModel.ProjectId, viewModel.ClaimId); var error = WithClaim(claim); if (error != null) { return(error); } try { if (!ModelState.IsValid) { return(await Edit(viewModel.ProjectId, viewModel.ClaimId)); } await FinanceService.FeeAcceptedOperation(claim.ProjectId, claim.ClaimId, CurrentUserId, viewModel.CommentText, viewModel.OperationDate, viewModel.FeeChange, viewModel.Money, viewModel.PaymentTypeId); return(RedirectToAction("Edit", "Claim", new { viewModel.ClaimId, viewModel.ProjectId })); } catch { return(await Edit(viewModel.ProjectId, viewModel.ClaimId)); } }
public async Task <ActionResult> FinanceOperation(FeeAcceptanceViewModel viewModel) { var claim = await _claimsRepository.GetClaim(viewModel.ProjectId, viewModel.ClaimId); if (claim == null) { return(HttpNotFound()); } var error = WithClaim(claim); if (error != null) { return(error); } try { if (!ModelState.IsValid) { return(await Edit(viewModel.ProjectId, viewModel.ClaimId)); } await FinanceService.FeeAcceptedOperation(new FeeAcceptedOperationRequest() { ProjectId = claim.ProjectId, ClaimId = claim.ClaimId, Contents = viewModel.CommentText, FeeChange = viewModel.FeeChange, Money = viewModel.Money, OperationDate = viewModel.OperationDate, PaymentTypeId = viewModel.PaymentTypeId, }); return(RedirectToAction("Edit", "Claim", new { viewModel.ClaimId, viewModel.ProjectId })); } catch { return(await Edit(viewModel.ProjectId, viewModel.ClaimId)); } }