public async Task <ActionResult <AssociateOption> > PostAssociateOption(AssociateOption AssociateOption) { _dbContext.AssociateOption.Add(AssociateOption); await _dbContext.SaveChangesAsync(); return(CreatedAtAction("GetAssociateOption", new { key = AssociateOption.AssociateOptionKey }, AssociateOption)); }
public async Task <IActionResult> PutAssociateOption(Guid key, AssociateOption AssociateOption) { if (key != AssociateOption.AssociateOptionKey) { return(BadRequest()); } _dbContext.Entry(AssociateOption).State = EntityState.Modified; try { await _dbContext.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AssociateOptionExists(key)) { return(NotFound()); } else { throw; } } return(NoContent()); }