public async Task <ActionResult> PutRecord(int id, InfomationModel infoModel) { if (id != infoModel.Id) { return(BadRequest()); } _infoPlusContext.Entry(infoModel).State = EntityState.Modified; try { await _infoPlusContext.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RecordExists(infoModel.Id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult> Post(InfomationModel infoModel) { var newId = await _infoPlusContext.Information.LastOrDefaultAsync(); infoModel.Id = newId.Id + 1; _infoPlusContext.Information.Add(infoModel); await _infoPlusContext.SaveChangesAsync(); return(NoContent()); }