public async Task <IActionResult> PostFundingOpportunityObjective([FromBody] FundingOpportunityObjective fundingOpportunityObjective) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.FundingOpportunityObjective.Add(fundingOpportunityObjective); await _context.SaveChangesAsync(); return(CreatedAtAction("GetFundingOpportunityObjective", new { id = fundingOpportunityObjective.FundingOpportunityObjectiveId }, fundingOpportunityObjective)); }
public async Task <IActionResult> PutFundingOpportunityObjective([FromRoute] Guid id, [FromBody] FundingOpportunityObjective fundingOpportunityObjective) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != fundingOpportunityObjective.FundingOpportunityObjectiveId) { return(BadRequest()); } _context.Entry(fundingOpportunityObjective).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FundingOpportunityObjectiveExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }