public async Task <IActionResult> PutGenericEvent([FromRoute] int id, [FromBody] GenericEvent genericEvent) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != genericEvent.Id) { return(BadRequest()); } _context.Entry(genericEvent).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!GenericEventExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostGenericPrediction([FromBody] GenericPrediction genericPrediction) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.GenericPrediction.Add(genericPrediction); await _context.SaveChangesAsync(); return(CreatedAtAction("GetGenericPrediction", new { id = genericPrediction.Id }, genericPrediction)); }
public async Task Save() { await _nostradamusContext.SaveChangesAsync(); }