public async Task <IActionResult> PutFundingProgram([FromRoute] Guid id, [FromBody] FundingProgram fundingProgram) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != fundingProgram.FundingProgramId) { return(BadRequest()); } _context.Entry(fundingProgram).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FundingProgramExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostFundingProgram([FromBody] FundingProgram fundingProgram) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.FundingProgram.Add(fundingProgram); await _context.SaveChangesAsync(); return(CreatedAtAction("GetFundingProgram", new { id = fundingProgram.FundingProgramId }, fundingProgram)); }