public async Task <IActionResult> PutSalerInfo(int id, SalerInfo salerInfo) { if (id != salerInfo.Id) { return(BadRequest()); } _context.Entry(salerInfo).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SalerInfoExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
static async Task Write(SalerDbContext context) { var r = await context.SalerInfo.AddAsync(new SalerInfo { UserName = "******", }); await context.SalerScore.AddAsync(new SalerScore { SalerId = r.Entity.Id, Score = 10 }); await context.SalerAddress.AddAsync(new SalerAddress { SalerId = r.Entity.Id, Address = "十里铺" }); await context.SaveChangesAsync(); }