private ContributionMonetaryDTO Create(ContributionMonetaryViewModel viewModel) { try { log.Debug(ContributionMonetaryViewModel.FormatContributionMonetaryViewModel(viewModel)); ContributionMonetaryDTO contributionMonetary = new ContributionMonetaryDTO(); // copy values viewModel.UpdateDTO(contributionMonetary, null); //RequestContext.Principal.Identity.GetUserId()); // audit contributionMonetary.CreateBy = null; //RequestContext.Principal.Identity.GetUserId(); contributionMonetary.CreateOn = DateTime.UtcNow; // add log.Debug("_contributionMonetaryService.AddContributionMonetary - " + ContributionMonetaryDTO.FormatContributionMonetaryDTO(contributionMonetary)); int id = _contributionMonetaryService.AddContributionMonetary(contributionMonetary); contributionMonetary.ContributionMonetaryId = id; log.Debug("result: 'success', id: " + id); return(contributionMonetary); } catch (Exception e) { // error log.Error(e.ToString()); throw; } }
private ContributionMonetaryDTO Update(ContributionMonetaryViewModel viewModel) { try { log.Debug(ContributionMonetaryViewModel.FormatContributionMonetaryViewModel(viewModel)); // get log.Debug("_contributionMonetaryService.GetContributionMonetary - contributionMonetaryId: " + viewModel.ContributionMonetaryId + " "); var existingContributionMonetary = _contributionMonetaryService.GetContributionMonetary(viewModel.ContributionMonetaryId); log.Debug("_contributionMonetaryService.GetContributionMonetary - " + ContributionMonetaryDTO.FormatContributionMonetaryDTO(existingContributionMonetary)); if (existingContributionMonetary != null) { // copy values viewModel.UpdateDTO(existingContributionMonetary, null); //RequestContext.Principal.Identity.GetUserId()); // update log.Debug("_contributionMonetaryService.UpdateContributionMonetary - " + ContributionMonetaryDTO.FormatContributionMonetaryDTO(existingContributionMonetary)); _contributionMonetaryService.UpdateContributionMonetary(existingContributionMonetary); log.Debug("result: 'success'"); } else { log.Error("existingContributionMonetary: null, ContributionMonetaryId: " + viewModel.ContributionMonetaryId); } return(existingContributionMonetary); } catch (Exception e) { // error log.Error(e.ToString()); throw; } }