public async Task <IHttpActionResult> PutEnteredChart(int id, EnteredChart enteredChart) { if (!this.ModelState.IsValid) { return(this.BadRequest(this.ModelState)); } if (id != enteredChart.EnteredChartId) { return(this.BadRequest()); } this.db.Entry(enteredChart).State = EntityState.Modified; try { await this.db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!this.EnteredChartExists(id)) { return(this.NotFound()); } else { throw; } } return(this.StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> GetEnteredChart(int id) { EnteredChart enteredChart = await this.db.EnteredCharts.FindAsync(id); if (enteredChart == null) { return(this.NotFound()); } return(this.Ok(enteredChart)); }
public async Task <IHttpActionResult> PostEnteredChart(EnteredChart enteredChart) { if (!this.ModelState.IsValid) { return(this.BadRequest(this.ModelState)); } this.db.EnteredCharts.Add(enteredChart); await this.db.SaveChangesAsync(); return(this.CreatedAtRoute("DefaultApi", new { id = enteredChart.EnteredChartId }, enteredChart)); }