コード例 #1
0
        public IHttpActionResult PostFundingSource(string apiKey, [FromBody] FundingSourceDto fundingSourceDto)
        {
            Check.Require(apiKey == FirmaWebApiConfiguration.PsInfoApiKey, "Unrecognized api key!");
            var fundingSource = new FundingSource(fundingSourceDto.OrganizationID,
                fundingSourceDto.FundingSourceName, fundingSourceDto.IsActive);
            fundingSource.FundingSourceDescription = fundingSourceDto.FundingSourceDescription;
            fundingSource.FundingSourceAmount = fundingSourceDto.FundingSourceAmount;

            var tenantID = Tenant.ActionAgendaForPugetSound.TenantID;
            _databaseEntities.AllFundingSources.Add(fundingSource);
            _databaseEntities.SaveChangesWithNoAuditing(tenantID);
            var fundingSourceReloaded = new FundingSourceDto(fundingSource);
            return Ok(fundingSourceReloaded);
        }
コード例 #2
0
        public IHttpActionResult UpdateFundingSource(string apiKey, [FromBody] FundingSourceDto fundingSourceDto)
        {
            Check.Require(apiKey == FirmaWebApiConfiguration.PsInfoApiKey, "Unrecognized api key!");
            var fundingSource = _databaseEntities.FundingSources.SingleOrDefault(x => x.FundingSourceID == fundingSourceDto.FundingSourceID);
            if (fundingSource == null)
            {
                var message = $"Funding Source with ID = {fundingSourceDto.FundingSourceID} not found";
                return NotFound();
            }

            fundingSource.OrganizationID = fundingSourceDto.OrganizationID;
            fundingSource.FundingSourceName = fundingSourceDto.FundingSourceName;
            fundingSource.IsActive = fundingSourceDto.IsActive;
            fundingSource.FundingSourceDescription = fundingSourceDto.FundingSourceDescription;
            fundingSource.FundingSourceAmount = fundingSourceDto.FundingSourceAmount;
            _databaseEntities.SaveChangesWithNoAuditing(Tenant.ActionAgendaForPugetSound.TenantID);
            var fundingSourceReloaded = new FundingSourceDto(fundingSource);
            return Ok(fundingSourceReloaded);
        }