public async Task <IActionResult> PostFundingOpportunityResource([FromBody] FundingOpportunityResource fundingOpportunityResource) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.FundingOpportunityResource.Add(fundingOpportunityResource); await _context.SaveChangesAsync(); return(CreatedAtAction("GetFundingOpportunityResource", new { id = fundingOpportunityResource.FundingOpportunityResourceId }, fundingOpportunityResource)); }
public async Task <IActionResult> PutFundingOpportunityResource([FromRoute] Guid id, [FromBody] FundingOpportunityResource fundingOpportunityResource) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != fundingOpportunityResource.FundingOpportunityResourceId) { return(BadRequest()); } _context.Entry(fundingOpportunityResource).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FundingOpportunityResourceExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }